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.
45 lines (37 loc) • 1.08 kB
JavaScript
;
(function () {
class CopyTreeNodeItemCommand {
constructor(_, CopyTreeNodeItemAction, TreeSelection) {
this._ = _;
this._TreeSelection = TreeSelection;
this._CopyTreeNodeItemAction = CopyTreeNodeItemAction;
}
canExec() {
return this._TreeSelection.hasSelected();
}
exec() {
if (this.canExec()) {
let _this = this;
return _this._CopyTreeNodeItemAction.exec({
nodeItem: this._TreeSelection.selItem(),
nodeItemType: this._TreeSelection.selItemType()
});
}
}
}
angular.module('editorApp')
.service('CopyTreeNodeItemCommand', CopyTreeNodeItemCommand)
.config(function (CommandPaletteCfgProvider, CommandContextMenuCfgProvider) {
CommandPaletteCfgProvider.addCommand({
service: 'CopyTreeNodeItemCommand',
name: 'core:Copy',
icon: 'copy',
hotkey: 'mod+c'
});
CommandContextMenuCfgProvider.addMenuItem({
title: 'Copy',
command: 'core:Copy',
order: 200
});
});
})();