diff options
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index f4de3070..319ffe87 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { | |||
19 | // TODO - Need to figure out how to remove this dependency | 19 | // TODO - Need to figure out how to remove this dependency |
20 | // 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 |
21 | drawNow: { value : false }, | 21 | drawNow: { value : false }, |
22 | switchedFromCodeDoc: { value : false }, | ||
22 | 23 | ||
23 | // TO REVIEW | 24 | // TO REVIEW |
24 | zoomFactor: {value : 1 }, | 25 | zoomFactor: {value : 1 }, |
@@ -249,9 +250,15 @@ exports.Stage = Montage.create(Component, { | |||
249 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; | 250 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; |
250 | this.currentDocument.model.userContentLeft = this._userContentLeft; | 251 | this.currentDocument.model.userContentLeft = this._userContentLeft; |
251 | this.currentDocument.model.userContentTop = this._userContentTop; | 252 | this.currentDocument.model.userContentTop = this._userContentTop; |
253 | this.currentDocument.model.templateLeft = this.templateLeft; | ||
254 | this.currentDocument.model.templateTop = this.templateTop; | ||
255 | this.currentDocument.model.minLeftElement = this.minLeftElement; | ||
256 | this.currentDocument.model.minTopElement = this.minTopElement; | ||
252 | 257 | ||
253 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | 258 | //call configure false with the old document on the selected tool to tear down down any temp. stuff |
254 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | 259 | this.application.ninja.toolsData.selectedToolInstance._configure(false); |
260 | } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { | ||
261 | this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar | ||
255 | } | 262 | } |
256 | 263 | ||
257 | this._currentDocument = value; | 264 | this._currentDocument = value; |
@@ -262,7 +269,8 @@ exports.Stage = Montage.create(Component, { | |||
262 | drawUtils._eltArray.length = 0; | 269 | drawUtils._eltArray.length = 0; |
263 | drawUtils._planesArray.length = 0; | 270 | drawUtils._planesArray.length = 0; |
264 | } else if(this._currentDocument.currentView === "design") { | 271 | } else if(this._currentDocument.currentView === "design") { |
265 | this.restoreAllPanels(); | 272 | this.restoreAllPanels(this.switchedFromCodeDoc); |
273 | this.switchedFromCodeDoc = false; | ||
266 | this.hideCanvas(false); | 274 | this.hideCanvas(false); |
267 | this.showRulers(); | 275 | this.showRulers(); |
268 | 276 | ||
@@ -279,6 +287,13 @@ exports.Stage = Montage.create(Component, { | |||
279 | _userPaddingLeft: { value: 0 }, | 287 | _userPaddingLeft: { value: 0 }, |
280 | _userPaddingTop: { value: 0 }, | 288 | _userPaddingTop: { value: 0 }, |
281 | 289 | ||
290 | templateLeft: { value: 0 }, | ||
291 | templateTop: { value: 0 }, | ||
292 | |||
293 | // keep track of the elements that determine the minimum left and top scrollable amount | ||
294 | minLeftElement: { value: null }, | ||
295 | minTopElement: { value: null }, | ||
296 | |||
282 | userPaddingLeft: { | 297 | userPaddingLeft: { |
283 | get: function() { return this._userPaddingLeft; }, | 298 | get: function() { return this._userPaddingLeft; }, |
284 | set: function(value) { | 299 | set: function(value) { |
@@ -374,6 +389,10 @@ exports.Stage = Montage.create(Component, { | |||
374 | this._userContentTop = this.currentDocument.model.userContentTop; | 389 | this._userContentTop = this.currentDocument.model.userContentTop; |
375 | this._scrollLeft = this.currentDocument.model.scrollLeft; | 390 | this._scrollLeft = this.currentDocument.model.scrollLeft; |
376 | this._scrollTop = this.currentDocument.model.scrollTop; | 391 | this._scrollTop = this.currentDocument.model.scrollTop; |
392 | this.templateLeft = this.currentDocument.model.templateLeft; | ||
393 | this.templateTop = this.currentDocument.model.templateTop; | ||
394 | this.minLeftElement = this.currentDocument.model.minLeftElement; | ||
395 | this.minTopElement = this.currentDocument.model.minTopElement; | ||
377 | } else { | 396 | } else { |
378 | this._userPaddingLeft = 0; | 397 | this._userPaddingLeft = 0; |
379 | this._userPaddingTop = 0; | 398 | this._userPaddingTop = 0; |
@@ -383,6 +402,10 @@ exports.Stage = Montage.create(Component, { | |||
383 | this._userContentTop = 0; | 402 | this._userContentTop = 0; |
384 | this._scrollLeft = 0; | 403 | this._scrollLeft = 0; |
385 | this._scrollTop = 0; | 404 | this._scrollTop = 0; |
405 | this.templateLeft = 0; | ||
406 | this.templateTop = 0; | ||
407 | this.minLeftElement = null; | ||
408 | this.minTopElement = null; | ||
386 | } | 409 | } |
387 | 410 | ||
388 | // Recalculate the canvas sizes because of splitter resizing | 411 | // Recalculate the canvas sizes because of splitter resizing |
@@ -400,9 +423,11 @@ exports.Stage = Montage.create(Component, { | |||
400 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); | 423 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); |
401 | if(initialLeft > this.documentOffsetLeft) { | 424 | if(initialLeft > this.documentOffsetLeft) { |
402 | this.userPaddingLeft = -initialLeft; | 425 | this.userPaddingLeft = -initialLeft; |
426 | this.templateLeft = -initialLeft; | ||
403 | } | 427 | } |
404 | if(initialTop > this.documentOffsetTop) { | 428 | if(initialTop > this.documentOffsetTop) { |
405 | this.userPaddingTop = -initialTop; | 429 | this.userPaddingTop = -initialTop; |
430 | this.templateTop = -initialTop; | ||
406 | } | 431 | } |
407 | } | 432 | } |
408 | 433 | ||
@@ -1250,11 +1275,11 @@ exports.Stage = Montage.create(Component, { | |||
1250 | } | 1275 | } |
1251 | }, | 1276 | }, |
1252 | restoreAllPanels:{ | 1277 | restoreAllPanels:{ |
1253 | value:function(){ | 1278 | value:function(onSwitchDocument){ |
1254 | this.application.ninja.panelSplitter.restore(); | 1279 | this.application.ninja.panelSplitter.restore(onSwitchDocument); |
1255 | this.application.ninja.timelineSplitter.restore(); | 1280 | this.application.ninja.timelineSplitter.restore(onSwitchDocument); |
1256 | this.application.ninja.toolsSplitter.restore(); | 1281 | this.application.ninja.toolsSplitter.restore(onSwitchDocument); |
1257 | this.application.ninja.optionsSplitter.restore(); | 1282 | this.application.ninja.optionsSplitter.restore(onSwitchDocument); |
1258 | } | 1283 | } |
1259 | }, | 1284 | }, |
1260 | 1285 | ||