owl-bt
Version:
owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.
33 lines (26 loc) • 702 B
JavaScript
;
(function() {
class FocusSelNodeCommand {
constructor(TreeSelection, TreeFocus) {
this._TreeSelection = TreeSelection;
this._TreeFocus = TreeFocus;
}
canExec() {
return this._TreeSelection.hasSelected();
}
exec() {
if (this.canExec()) {
this._TreeFocus.focusNode(this._TreeSelection.selNode());
}
}
}
angular.module('editorApp')
.service('FocusSelNodeCommand', FocusSelNodeCommand)
.config(function(CommandPaletteCfgProvider) {
CommandPaletteCfgProvider.addCommand({
service: 'FocusSelNodeCommand',
name: 'core:Focus Selected Node',
icon: 'crosshairs'
});
});
})();