aboutsummaryrefslogtreecommitdiff
path: root/js/ninja.reel/ninja.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-xjs/ninja.reel/ninja.js139
1 files changed, 137 insertions, 2 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js
index c76c7d46..9b5081dd 100755
--- a/js/ninja.reel/ninja.js
+++ b/js/ninja.reel/ninja.js
@@ -6,6 +6,7 @@
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component, 8 Component = require("montage/ui/component").Component,
9 UndoManager = require("montage/core/undo-manager").UndoManager,
9 AppData = require("js/data/appdata").AppData; 10 AppData = require("js/data/appdata").AppData;
10 11
11var matrix = require("js/lib/math/matrix"); 12var matrix = require("js/lib/math/matrix");
@@ -23,6 +24,113 @@ exports.Ninja = Montage.create(Component, {
23 value: null 24 value: null
24 }, 25 },
25 26
27 _isResizing: {
28 value: null
29 },
30 _resizedHeight : {
31 value: 0
32 },
33 _height: {
34 value: null
35 },
36
37 height: {
38 get: function() {
39 if(this._height === null) {
40 var storedData = this.application.localStorage.getItem("timelinePanel");
41 if(storedData && storedData.value) {
42 this._height = storedData.value;
43 }
44 }
45 return this._height;
46 },
47 set: function(val) {
48 if(this._height != val) {
49 this._height = val;
50 this.application.localStorage.setItem("timelinePanel", {"version": this.version, "value": val});
51 this.needsDraw = true;
52 }
53
54 }
55 },
56
57 _resizedWidth : {
58 value: 0
59 },
60 _width: {
61 value: null
62 },
63
64 width: {
65 get: function() {
66 if(this._width === null) {
67 var storedData = this.application.localStorage.getItem("rightPanelsContainer");
68 if(storedData && storedData.value) {
69 this._width = storedData.value;
70 }
71 }
72 return this._width;
73 },
74 set: function(val) {
75 if(this._width != val) {
76 this._width = val;
77 this.application.localStorage.setItem("rightPanelsContainer", {"version": this.version, "value": val});
78 this.needsDraw = true;
79 }
80
81 }
82 },
83
84 handleResizeStart: {
85 value:function(e) {
86 this.isResizing = true;
87 this.height = parseInt(this.timeline.element.offsetHeight);
88 this.width = parseInt(this.rightPanelContainer.offsetWidth);
89 this.rightPanelContainer.classList.add("disableTransition");
90 this.timeline.element.classList.add("disableTransition");
91 this.needsDraw = true;
92 }
93 },
94
95 handleResizeMove: {
96 value:function(e) {
97 this._resizedHeight = e._event.dY;
98 this._resizedWidth = e._event.dX;
99 this.stage.resizeCanvases = true;
100 this.needsDraw = true;
101 }
102 },
103
104 handleResizeEnd: {
105 value: function(e) {
106// this.height -= this._resizedHeight;
107// this.width -= this._resizedWidth;
108 this.stage.resizeCanvases = true;
109 this._resizedHeight = 0;
110 this._resizedWidth = 0;
111 this.isResizing = false;
112 this.needsDraw = true;
113 this.rightPanelContainer.classList.remove("disableTransition");
114 this.timeline.element.classList.remove("disableTransition");
115 this.height = this.timeline.element.offsetHeight;
116 this.width = this.rightPanelContainer.offsetWidth;
117 }
118 },
119
120 handleResizeReset: {
121 value: function(e) {
122 this.width = 253;
123 this.height = 140;
124 this._resizedHeight = 0;
125 this._resizedWidth = 0;
126 this.timelineSplitter.collapsed = false;
127 this.panelSplitter.collapsed = false;
128 this.stage.resizeCanvases = true;
129 this.needsDraw = true;
130 }
131 },
132
133
26 selectedElements: { 134 selectedElements: {
27 value: [] 135 value: []
28 }, 136 },
@@ -34,7 +142,7 @@ exports.Ninja = Montage.create(Component, {
34 templateDidLoad: { 142 templateDidLoad: {
35 value: function() { 143 value: function() {
36 this.ninjaVersion = window.ninjaVersion.ninja.version; 144 this.ninjaVersion = window.ninjaVersion.ninja.version;
37 this.eventManager.addEventListener( "preloadFinish", this, false); 145 this.undoManager = document.application.undoManager = UndoManager.create();
38 } 146 }
39 }, 147 },
40 148
@@ -53,7 +161,6 @@ exports.Ninja = Montage.create(Component, {
53 161
54 window.addEventListener("resize", this, false); 162 window.addEventListener("resize", this, false);
55 163
56// this.eventManager.addEventListener( "appLoading", this, false); // Don't need this anymore
57 this.eventManager.addEventListener( "selectTool", this, false); 164 this.eventManager.addEventListener( "selectTool", this, false);
58 this.eventManager.addEventListener( "selectSubTool", this, false); 165 this.eventManager.addEventListener( "selectSubTool", this, false);
59 this.eventManager.addEventListener( "onOpenDocument", this, false); 166 this.eventManager.addEventListener( "onOpenDocument", this, false);
@@ -78,12 +185,40 @@ exports.Ninja = Montage.create(Component, {
78 } 185 }
79 }, 186 },
80 187
188 willDraw: {
189 value: function() {
190
191 }
192 },
193
194 draw: {
195 value: function() {
196 if(this.isResizing) {
197 if (this.height - this._resizedHeight < 46) {
198 this.timelineSplitter.collapsed = true;
199 } else {
200 this.timelineSplitter.collapsed = false;
201 }
202
203 if (this.width - this._resizedWidth < 30) {
204 this.panelSplitter.collapsed = true;
205 } else {
206 this.panelSplitter.collapsed = false;
207 }
208
209 }
210 this.rightPanelContainer.style.width = (this.width - this._resizedWidth) + "px";
211 this.timeline.element.style.height = (this.height - this._resizedHeight) + "px";
212 }
213 },
214
81 _didDraw: { 215 _didDraw: {
82 value: false 216 value: false
83 }, 217 },
84 218
85 didDraw: { 219 didDraw: {
86 value: function() { 220 value: function() {
221
87 if(!this._didDraw) { 222 if(!this._didDraw) {
88 if (!this.application.ninja.coreIoApi.ioServiceDetected) { 223 if (!this.application.ninja.coreIoApi.ioServiceDetected) {
89 var check = this.application.ninja.coreIoApi.cloudAvailable(); 224 var check = this.application.ninja.coreIoApi.cloudAvailable();