1 line
6.7 KiB
JavaScript
1 line
6.7 KiB
JavaScript
|
|
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),i=e(require("./visualizer")),o=e(require("./timeline")),s=e(require("../../atom-react/mixins/pane-resize-event-mixin")),n=e(require("../../common/layout/layout")),r=e(require("../../common/layout/h-layout")),a=e(require("../../common/layout/v-layout")),d=e(require("./properties")),l=e(require("./face/face")),p=e(require("./video/video")),c=require("atom").CompositeDisposable,h=e(require("../../atom-react/core/react-editor")),u=e(require("lodash")),m=e(require("fs")),f=t.createClass({displayName:"EditorView",mixins:[s],getInitialState:function(){return{visualizerWidth:0,visualizerHeight:0,timelineWidth:0,timelineHeight:0,focusOnProps:!0}},componentWillMount:function(){var e=this,t=this;this.props.editor.animationModel.on("ondatachanged",function(){t.forceUpdate()}),this.props.editor.animationModel.on("onpropertieschanged",function(){e.checkModified()}),this.props.editor.animationModel.on("save",function(){e.checkModified()})},checkModified:function(){var e=this;try{m.readFile(this.props.editor.uri,"utf8",function(t,i){var o=JSON.parse(i);e.props.editor.animationModel.state&&(u.isEqual(o,e.props.editor.animationModel.state.keyframes)?e.props.editor.setModifiedStatus(!1):e.props.editor.setModifiedStatus(!0))})}catch(t){console.warn("error reading keyframes file, ",t)}},componentDidMount:function(){var e=this;this.setupPaneResizeEventMixin(),this.disposables=new c,this.disposables.add(atom.commands.add(this.getDOMNode(),{"jibo-sdk:select-all-keyframes":this.selectAllKeyframes,"jibo-sdk:clear-keyframe-selection":this.clearKeyframeSelection,"jibo-sdk:upsert-keyframe":this.upsertKeyframe,"jibo-sdk:upsert-all":this.upsertAllKeyframes,"jibo-sdk:reset-keyframes":this.resetKeyframes,"jibo-sdk:delete":this.deletePressed,"jibo-sdk:start-playing":this.startPlaying,"jibo-sdk:stop-playing":this.stopPlaying,"jibo-sdk:step-backward":this.stepBackward,"jibo-sdk:step-forward":this.stepForward,"jibo-sdk:next-layer":this.nextLayer,"jibo-sdk:previous-layer":this.previousLayer,"core:undo":this.undo,"core:redo":this.redo,"core:cut":this.cut,"core:copy":this.copy,"core:paste":this.paste,"jibo-sdk:lose-focus":this.setEditorFocus,"jibo-sdk:upsert-and-save":this.upsertAndSave}));var t=this;requestAnimationFrame(function(){t.setState({visualizerWidth:Math.floor(e.props.paneWidth/2)-4,visualizerHeight:Math.floor(e.props.paneHeight/2)-4,timelineWidth:Math.floor(e.props.paneWidth/2)-4,timelineHeight:Math.floor(e.props.paneHeight/2)-20})}),this.onFocusInCB=this.onFocusIn.bind(this),this.getDOMNode().addEventListener("focusin",this.onFocusInCB,!0),this.onFocusOutCB=this.onFocusOut.bind(this),this.getDOMNode().addEventListener("focusout",this.onFocusOutCB,!0)},onFocusIn:function(){},onFocusOut:function(e){this.props.editor.isPaneActive()!==!1&&(null===e.relatedTarget||e.relatedTarget===document.getElementsByClassName("workspace")[0])&&this.getDOMNode().focus()},startPlaying:function(){this.props.editor.animationModel.togglePlay()},stopPlaying:function(){this.props.editor.animationModel.isPlaying()&&this.props.editor.animationModel.togglePlay()},stepBackward:function(){this.props.editor.animationModel.stepTimeBackward(),this.props.editor.animationModel.keyframeSelection.clearSelection()},stepForward:function(){this.props.editor.animationModel.stepTimeForward(),this.props.editor.animationModel.keyframeSelection.clearSelection()},nextLayer:function(){this.props.editor.animationModel.nextLayer()},previousLayer:function(){this.props.editor.animationModel.previousLayer()},undo:function(){this.props.editor.animationModel.undo()},redo:function(){this.props.editor.animationModel.redo()},cut:function(){this.props.editor.animationModel.keyframeSelection.cutSelectedKeyframes()},copy:function(){this.props.editor.animationModel.keyframeSelection.copySelectedKeyframes()},paste:function(){if(this.props.editor.animationModel.keyframeSelection.isSingleSelect()){var e=this.props.editor.animationModel.keyframeSelection.getCurrentKeyframe();this.props.editor.animationModel.keyframeSele
|