Files
JiboSDK/lib/animation-editor/animation-editor.js
2026-03-22 03:21:45 +02:00

1 line
3.3 KiB
JavaScript

"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var i in t){var o=t[i];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),i=function d(e,t,i){var o=Object.getOwnPropertyDescriptor(e,t);if(void 0===o){var a=Object.getPrototypeOf(e);return null===a?void 0:d(a,t,i)}if("value"in o&&o.writable)return o.value;var n=o.get;if(void 0!==n)return n.call(i)},o=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=e(require("path")),r=e(require("../atom-react/core/react-editor")),u=e(require("./views/editor")),l=e(require("./models/animation-model")),s=e(require("../common/tree-view-helper")),c=e(require("./audio/multi-audio-playback")),AnimationEditor=function(e){function AnimationEditor(e){a(this,AnimationEditor),i(Object.getPrototypeOf(AnimationEditor.prototype),"constructor",this).call(this,e,!1);var t=this.getUiState();this.layout=t?t:[];var o=r.getProjectRoot(e);this.animationModel=new l(this,o),this.animationModel.audio=new c(this.animationModel,o)}return o(AnimationEditor,e),t(AnimationEditor,{serialize:{value:function(){return this.saveUiState(this.layout),i(Object.getPrototypeOf(AnimationEditor.prototype),"serialize",this).call(this)}},dispose:{value:function(){this.saveUiState(this.layout),i(Object.getPrototypeOf(AnimationEditor.prototype),"dispose",this).call(this),this.animationModel.dispose(),this.animationModel.audio.dispose()}},onPaneActivated:{value:function(){var e=this;setTimeout(function(){e.container.childNodes[0]&&e.container.childNodes[0].focus()},1)}},focus:{value:function(){this.container.childNodes[0]&&this.container.childNodes[0].focus()}},onPaneDeactivated:{value:function(){}},getReactClass:{value:function(){return u}},saveFile:{value:function(e){return AnimationEditor.isValidDirectory(e)?(this.animationModel.saveFile(e),this.animationModel.backup(),!0):(alert('You must save animations under the "animations" folder.'),!1)}},reload:{value:function(){this.animationModel.reloadFile(this.uri)}},getSaveDialogOptions:{value:function(){return{title:"Animation Save As",filters:AnimationEditor.getDialogFilter()}}}},{createNewFile:{value:function(){var e=s.getFolderPathWithDirectory(s.getFolderPathOfSelection(),"animations");if(!e)return void alert("You must have a valid project loaded in order to create a new animation.");var t=atom.getCurrentWindow(),i=require("remote"),o=i.require("dialog");o.showSaveDialog(t,{title:"New Animation",defaultPath:e,filters:AnimationEditor.getDialogFilter()},function(e){e&&(AnimationEditor.isValidDirectory(e)?(l.createNewFile(e),atom.workspace.open(e)):alert('You must save animations under the "animations" folder.'))})}},isValidDirectory:{value:function(e){var t=n.normalize("/animations/");return e.includes(t)?!0:!1}},getDialogFilter:{value:function(){return[{name:"Animation",extensions:["keys"]}]}}}),AnimationEditor}(r);atom.deserializers.add(AnimationEditor),module.exports=AnimationEditor;