diff options
author | Ananya Sen | 2012-06-19 11:00:49 -0700 |
---|---|---|
committer | Ananya Sen | 2012-06-19 11:00:49 -0700 |
commit | f1d8401aeb84e0eb0680caf72878dae26fd78a37 (patch) | |
tree | 31771ccaf3d1e2ddf01fa9605438d20be0d155d7 /js/stage/stage.reel/stage.js | |
parent | 9ea2610cec6569e7b7d5268b6c65bbf94c4753e5 (diff) | |
parent | 483ad57efcd6475776f580c3af5b60e6deeaf781 (diff) | |
download | ninja-f1d8401aeb84e0eb0680caf72878dae26fd78a37.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 121 |
1 files changed, 97 insertions, 24 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 18de2adc..f4de3070 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -11,6 +11,11 @@ var Montage = require("montage/core/core").Montage, | |||
11 | 11 | ||
12 | exports.Stage = Montage.create(Component, { | 12 | exports.Stage = Montage.create(Component, { |
13 | 13 | ||
14 | appModel: { | ||
15 | value: null, | ||
16 | serializable: true | ||
17 | }, | ||
18 | |||
14 | // TODO - Need to figure out how to remove this dependency | 19 | // TODO - Need to figure out how to remove this dependency |
15 | // Needed by some tools that depend on selectionDrawn event to set up some logic | 20 | // Needed by some tools that depend on selectionDrawn event to set up some logic |
16 | drawNow: { value : false }, | 21 | drawNow: { value : false }, |
@@ -22,7 +27,10 @@ exports.Stage = Montage.create(Component, { | |||
22 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, | 27 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, |
23 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, | 28 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, |
24 | 29 | ||
25 | _iframeContainer: { value: null }, | 30 | _iframeContainer: { |
31 | value: null, | ||
32 | serializable: true | ||
33 | }, | ||
26 | 34 | ||
27 | _scrollFlag: {value: true, writable: true}, | 35 | _scrollFlag: {value: true, writable: true}, |
28 | outFlag: { value: false, writable: true }, | 36 | outFlag: { value: false, writable: true }, |
@@ -88,29 +96,82 @@ exports.Stage = Montage.create(Component, { | |||
88 | }, | 96 | }, |
89 | 97 | ||
90 | /** MAIN CANVASES **/ | 98 | /** MAIN CANVASES **/ |
91 | _canvas: { value: null }, // selection bounds, 3d normals and the overall 3d selection box use this canvas | 99 | // selection bounds, 3d normals and the overall 3d selection box use this canvas |
92 | canvas: { get: function() { return this._canvas; } }, | 100 | _canvas: { |
101 | value: null, | ||
102 | serializable: true | ||
103 | }, | ||
104 | |||
105 | canvas: { | ||
106 | get: function() { | ||
107 | return this._canvas; | ||
108 | } | ||
109 | }, | ||
93 | 110 | ||
94 | _context: { value: null }, | 111 | _context: { value: null }, |
95 | context: { get: function() { return this._context; } }, | 112 | context: { get: function() { return this._context; } }, |
96 | 113 | ||
97 | _layoutCanvas: { value: null }, | 114 | _layoutCanvas: { |
98 | layoutCanvas: { get: function() { return this._layoutCanvas; } }, | 115 | value: null, |
116 | serializable: true | ||
117 | }, | ||
99 | 118 | ||
100 | _gridCanvas: { value: null }, | 119 | layoutCanvas: { |
101 | gridCanvas: { get: function() { return this._gridCanvas; } }, | 120 | get: function() { |
121 | return this._layoutCanvas; | ||
122 | } | ||
123 | }, | ||
124 | |||
125 | _gridCanvas: { | ||
126 | value: null, | ||
127 | serializable: true | ||
128 | }, | ||
129 | |||
130 | gridCanvas: { | ||
131 | get: function() { | ||
132 | return this._gridCanvas; | ||
133 | } | ||
134 | }, | ||
102 | 135 | ||
103 | _gridContext: { value: null }, | 136 | _gridContext: { value: null }, |
104 | gridContext: { get: function() { return this._gridContext; } }, | 137 | gridContext: { get: function() { return this._gridContext; } }, |
105 | 138 | ||
106 | _drawingCanvas: { value: null }, | 139 | _drawingCanvas: { |
107 | drawingCanvas: { get: function() { return this._drawingCanvas; } }, | 140 | value: null, |
141 | serializable: true | ||
142 | }, | ||
143 | |||
144 | drawingCanvas: { | ||
145 | get: function() { | ||
146 | return this._drawingCanvas; | ||
147 | } | ||
148 | }, | ||
108 | 149 | ||
109 | _drawingContext: { value: null }, | 150 | _drawingContext: { value: null }, |
110 | drawingContext: { get: function() { return this._drawingContext; } }, | 151 | drawingContext: { get: function() { return this._drawingContext; } }, |
111 | 152 | ||
112 | _clickPoint: { value: { x: { value: null }, y: { value: null } } }, | 153 | _clickPoint: { value: { x: { value: null }, y: { value: null } } }, |
113 | 154 | ||
155 | stageDeps: { | ||
156 | value: null, | ||
157 | serializable: true | ||
158 | }, | ||
159 | |||
160 | layout: { | ||
161 | value: null, | ||
162 | serializable: true | ||
163 | }, | ||
164 | |||
165 | textTool: { | ||
166 | value: null, | ||
167 | serializable: true | ||
168 | }, | ||
169 | |||
170 | focusManager: { | ||
171 | value: null, | ||
172 | serializable: true | ||
173 | }, | ||
174 | |||
114 | // We will set this to false while moving objects to improve performance | 175 | // We will set this to false while moving objects to improve performance |
115 | showSelectionBounds: { value: true }, | 176 | showSelectionBounds: { value: true }, |
116 | 177 | ||
@@ -182,6 +243,13 @@ exports.Stage = Montage.create(Component, { | |||
182 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { | 243 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { |
183 | this.currentDocument.model.scrollLeft = this._scrollLeft; | 244 | this.currentDocument.model.scrollLeft = this._scrollLeft; |
184 | this.currentDocument.model.scrollTop = this._scrollTop; | 245 | this.currentDocument.model.scrollTop = this._scrollTop; |
246 | this.currentDocument.model.userPaddingLeft = this._userPaddingLeft; | ||
247 | this.currentDocument.model.userPaddingTop = this._userPaddingTop; | ||
248 | this.currentDocument.model.documentOffsetLeft = this._documentOffsetLeft; | ||
249 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; | ||
250 | this.currentDocument.model.userContentLeft = this._userContentLeft; | ||
251 | this.currentDocument.model.userContentTop = this._userContentTop; | ||
252 | |||
185 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | 253 | //call configure false with the old document on the selected tool to tear down down any temp. stuff |
186 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | 254 | this.application.ninja.toolsData.selectedToolInstance._configure(false); |
187 | } | 255 | } |
@@ -298,6 +366,23 @@ exports.Stage = Montage.create(Component, { | |||
298 | 366 | ||
299 | if(model.scrollLeft != null) { | 367 | if(model.scrollLeft != null) { |
300 | didSwitch = true; | 368 | didSwitch = true; |
369 | this._userPaddingLeft = this.currentDocument.model.userPaddingLeft; | ||
370 | this._userPaddingTop = this.currentDocument.model.userPaddingTop; | ||
371 | this._documentOffsetLeft = this.currentDocument.model.documentOffsetLeft; | ||
372 | this._documentOffsetTop = this.currentDocument.model.documentOffsetTop; | ||
373 | this._userContentLeft = this.currentDocument.model.userContentLeft; | ||
374 | this._userContentTop = this.currentDocument.model.userContentTop; | ||
375 | this._scrollLeft = this.currentDocument.model.scrollLeft; | ||
376 | this._scrollTop = this.currentDocument.model.scrollTop; | ||
377 | } else { | ||
378 | this._userPaddingLeft = 0; | ||
379 | this._userPaddingTop = 0; | ||
380 | this._documentOffsetLeft = 0; | ||
381 | this._documentOffsetTop = 0; | ||
382 | this._userContentLeft = 0; | ||
383 | this._userContentTop = 0; | ||
384 | this._scrollLeft = 0; | ||
385 | this._scrollTop = 0; | ||
301 | } | 386 | } |
302 | 387 | ||
303 | // Recalculate the canvas sizes because of splitter resizing | 388 | // Recalculate the canvas sizes because of splitter resizing |
@@ -308,19 +393,7 @@ exports.Stage = Montage.create(Component, { | |||
308 | 393 | ||
309 | this.addPropertyChangeListener("appModel.show3dGrid", this, false); | 394 | this.addPropertyChangeListener("appModel.show3dGrid", this, false); |
310 | 395 | ||
311 | this._userPaddingLeft = 0; | 396 | this.initialize3DOnOpenDocument(!didSwitch); |
312 | this._userPaddingTop = 0; | ||
313 | |||
314 | this._documentOffsetLeft = 0; | ||
315 | this._documentOffsetTop = 0; | ||
316 | |||
317 | this._userContentLeft = 0; | ||
318 | this._userContentTop = 0; | ||
319 | |||
320 | this._scrollLeft = 0; | ||
321 | this._scrollTop = 0; | ||
322 | |||
323 | this.initialize3DOnOpenDocument(); | ||
324 | 397 | ||
325 | if(designView._template) { | 398 | if(designView._template) { |
326 | var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); | 399 | var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); |
@@ -1186,7 +1259,7 @@ exports.Stage = Montage.create(Component, { | |||
1186 | }, | 1259 | }, |
1187 | 1260 | ||
1188 | initialize3DOnOpenDocument: { | 1261 | initialize3DOnOpenDocument: { |
1189 | value: function() { | 1262 | value: function(adjustScrollOffsets) { |
1190 | 1263 | ||
1191 | workingPlane = [0,0,1,0]; | 1264 | workingPlane = [0,0,1,0]; |
1192 | 1265 | ||
@@ -1197,7 +1270,7 @@ exports.Stage = Montage.create(Component, { | |||
1197 | this.snapManager.currentStage = this.currentDocument.model.documentRoot; | 1270 | this.snapManager.currentStage = this.currentDocument.model.documentRoot; |
1198 | this.snapManager.setupDragPlaneFromPlane (workingPlane); | 1271 | this.snapManager.setupDragPlaneFromPlane (workingPlane); |
1199 | 1272 | ||
1200 | this.drawUtils.initializeFromDocument(); | 1273 | this.drawUtils.initializeFromDocument(adjustScrollOffsets); |
1201 | } | 1274 | } |
1202 | } | 1275 | } |
1203 | 1276 | ||