UNPKG

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.

34 lines (31 loc) 1.1 kB
'use strict'; (function () { class CopyTreeNodeItemAction { constructor(ActionExecutor, TreeStore, TreeNodeDtoConverter, TreeSelection, Clipboard) { this._ActionExecutor = ActionExecutor; this._TreeStore = TreeStore; this._TreeNodeDtoConverter = TreeNodeDtoConverter; this._TreeSelection = TreeSelection; this._Clipboard = Clipboard; } /** * @param {object} params * @param {node|service|decorator} params.nodeItem - node item that should be copyied * @param {string} params.nodeItemType - type of the node item */ exec(params) { let _this = this; this._ActionExecutor.exec({ exec: () => { const dto = params.nodeItemType === 'node' ? _this._TreeNodeDtoConverter.convert(params.nodeItem) : _this._TreeNodeDtoConverter.convertSubItem(params.nodeItem) _this._Clipboard.set('tree', { item: dto, itemType: params.nodeItemType }); } }); } } angular.module('editorApp') .service('CopyTreeNodeItemAction', CopyTreeNodeItemAction); })();