aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-06-14 10:25:28 -0700
committerNivesh Rajbhandari2012-06-14 10:25:28 -0700
commit5b5e059a8dabc02d78fcde1bf271c2e49af6334a (patch)
tree0eab5e318c4a174360ae019c64623c53e5d8b04b /js
parent06679a2c21c6c749c8b3ea1a74431f6833726062 (diff)
downloadninja-5b5e059a8dabc02d78fcde1bf271c2e49af6334a.tar.gz
IKNinja-1710 - Boundary box is drawn offset when switching between docs. This issue is related to move object to negative space.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js18
-rwxr-xr-xjs/stage/stage.reel/stage.js42
2 files changed, 37 insertions, 23 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bef1e435..6a84c86b 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -117,7 +117,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
117 }, 117 },
118 118
119 initializeFromDocument:{ 119 initializeFromDocument:{
120 value:function(){ 120 value:function(adjustScrollOffsets){
121 var i, 121 var i,
122 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), 122 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
123 stage = this.application.ninja.stage, 123 stage = this.application.ninja.stage,
@@ -144,13 +144,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
144 for(i=0; i<len; i++) { 144 for(i=0; i<len; i++) {
145 elt = documentRootChildren[i]; 145 elt = documentRootChildren[i];
146 plane = this.addElement(elt); 146 plane = this.addElement(elt);
147 l = plane._rect.m_left - docLeft; 147 if(adjustScrollOffsets) {
148 t = plane._rect.m_top - docTop; 148 l = plane._rect.m_left - docLeft;
149 if(l < minLeft) { 149 t = plane._rect.m_top - docTop;
150 minLeft = l; 150 if(l < minLeft) {
151 } 151 minLeft = l;
152 if(t < minTop) { 152 }
153 minTop = t; 153 if(t < minTop) {
154 minTop = t;
155 }
154 } 156 }
155 } 157 }
156 if(minLeft !== initL) { 158 if(minLeft !== initL) {
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 129bcc33..fce73882 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -243,6 +243,13 @@ exports.Stage = Montage.create(Component, {
243 if(this.currentDocument && (this.currentDocument.currentView === "design")) { 243 if(this.currentDocument && (this.currentDocument.currentView === "design")) {
244 this.currentDocument.model.scrollLeft = this._scrollLeft; 244 this.currentDocument.model.scrollLeft = this._scrollLeft;
245 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
246 //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
247 this.application.ninja.toolsData.selectedToolInstance._configure(false); 254 this.application.ninja.toolsData.selectedToolInstance._configure(false);
248 } 255 }
@@ -359,6 +366,23 @@ exports.Stage = Montage.create(Component, {
359 366
360 if(model.scrollLeft != null) { 367 if(model.scrollLeft != null) {
361 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;
362 } 386 }
363 387
364 // Recalculate the canvas sizes because of splitter resizing 388 // Recalculate the canvas sizes because of splitter resizing
@@ -369,19 +393,7 @@ exports.Stage = Montage.create(Component, {
369 393
370 this.addPropertyChangeListener("appModel.show3dGrid", this, false); 394 this.addPropertyChangeListener("appModel.show3dGrid", this, false);
371 395
372 this._userPaddingLeft = 0; 396 this.initialize3DOnOpenDocument(!didSwitch);
373 this._userPaddingTop = 0;
374
375 this._documentOffsetLeft = 0;
376 this._documentOffsetTop = 0;
377
378 this._userContentLeft = 0;
379 this._userContentTop = 0;
380
381 this._scrollLeft = 0;
382 this._scrollTop = 0;
383
384 this.initialize3DOnOpenDocument();
385 397
386 if(designView._template) { 398 if(designView._template) {
387 var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); 399 var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2);
@@ -1247,7 +1259,7 @@ exports.Stage = Montage.create(Component, {
1247 }, 1259 },
1248 1260
1249 initialize3DOnOpenDocument: { 1261 initialize3DOnOpenDocument: {
1250 value: function() { 1262 value: function(adjustScrollOffsets) {
1251 1263
1252 workingPlane = [0,0,1,0]; 1264 workingPlane = [0,0,1,0];
1253 1265
@@ -1258,7 +1270,7 @@ exports.Stage = Montage.create(Component, {
1258 this.snapManager.currentStage = this.currentDocument.model.documentRoot; 1270 this.snapManager.currentStage = this.currentDocument.model.documentRoot;
1259 this.snapManager.setupDragPlaneFromPlane (workingPlane); 1271 this.snapManager.setupDragPlaneFromPlane (workingPlane);
1260 1272
1261 this.drawUtils.initializeFromDocument(); 1273 this.drawUtils.initializeFromDocument(adjustScrollOffsets);
1262 } 1274 }
1263 } 1275 }
1264 1276