aboutsummaryrefslogtreecommitdiff
path: root/js/stage/stage.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/stage.reel')
-rwxr-xr-xjs/stage/stage.reel/stage.js37
1 files changed, 31 insertions, 6 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 1de4e003..14bc00eb 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) {
@@ -372,6 +387,10 @@ exports.Stage = Montage.create(Component, {
372 this._userContentTop = this.currentDocument.model.userContentTop; 387 this._userContentTop = this.currentDocument.model.userContentTop;
373 this._scrollLeft = this.currentDocument.model.scrollLeft; 388 this._scrollLeft = this.currentDocument.model.scrollLeft;
374 this._scrollTop = this.currentDocument.model.scrollTop; 389 this._scrollTop = this.currentDocument.model.scrollTop;
390 this.templateLeft = this.currentDocument.model.templateLeft;
391 this.templateTop = this.currentDocument.model.templateTop;
392 this.minLeftElement = this.currentDocument.model.minLeftElement;
393 this.minTopElement = this.currentDocument.model.minTopElement;
375 } else { 394 } else {
376 this._userPaddingLeft = 0; 395 this._userPaddingLeft = 0;
377 this._userPaddingTop = 0; 396 this._userPaddingTop = 0;
@@ -381,6 +400,10 @@ exports.Stage = Montage.create(Component, {
381 this._userContentTop = 0; 400 this._userContentTop = 0;
382 this._scrollLeft = 0; 401 this._scrollLeft = 0;
383 this._scrollTop = 0; 402 this._scrollTop = 0;
403 this.templateLeft = 0;
404 this.templateTop = 0;
405 this.minLeftElement = null;
406 this.minTopElement = null;
384 } 407 }
385 408
386 // Recalculate the canvas sizes because of splitter resizing 409 // Recalculate the canvas sizes because of splitter resizing
@@ -398,9 +421,11 @@ exports.Stage = Montage.create(Component, {
398 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); 421 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2);
399 if(initialLeft > this.documentOffsetLeft) { 422 if(initialLeft > this.documentOffsetLeft) {
400 this.userPaddingLeft = -initialLeft; 423 this.userPaddingLeft = -initialLeft;
424 this.templateLeft = -initialLeft;
401 } 425 }
402 if(initialTop > this.documentOffsetTop) { 426 if(initialTop > this.documentOffsetTop) {
403 this.userPaddingTop = -initialTop; 427 this.userPaddingTop = -initialTop;
428 this.templateTop = -initialTop;
404 } 429 }
405 } 430 }
406 431
@@ -1277,11 +1302,11 @@ exports.Stage = Montage.create(Component, {
1277 } 1302 }
1278 }, 1303 },
1279 restoreAllPanels:{ 1304 restoreAllPanels:{
1280 value:function(){ 1305 value:function(onSwitchDocument){
1281 this.application.ninja.panelSplitter.restore(); 1306 this.application.ninja.panelSplitter.restore(onSwitchDocument);
1282 this.application.ninja.timelineSplitter.restore(); 1307 this.application.ninja.timelineSplitter.restore(onSwitchDocument);
1283 this.application.ninja.toolsSplitter.restore(); 1308 this.application.ninja.toolsSplitter.restore(onSwitchDocument);
1284 this.application.ninja.optionsSplitter.restore(); 1309 this.application.ninja.optionsSplitter.restore(onSwitchDocument);
1285 } 1310 }
1286 }, 1311 },
1287 1312