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.
40 lines (33 loc) • 830 B
JavaScript
;
(function () {
class UndoCommand {
constructor(UndoRedoManager, UndoAction) {
this._UndoRedoManager = UndoRedoManager;
this._UndoAction = UndoAction;
}
canExec() {
return this._UndoRedoManager.hasUndo();
}
exec() {
if (this.canExec()) {
this._UndoAction.exec();
}
}
}
angular.module('editorApp')
.service('UndoCommand', UndoCommand)
.config(function (CommandPaletteCfgProvider, CommandTopMenuCfgProvider) {
CommandPaletteCfgProvider.addCommand({
service: 'UndoCommand',
name: 'core:Undo',
icon: 'undo',
hotkey: 'mod+z'
});
CommandTopMenuCfgProvider.addMenuItem({
title: 'Undo',
section: 'Edit',
command: 'core:Undo',
order: 200
});
});
})();