aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js42
-rwxr-xr-xjs/stage/stage.reel/stage.js4
2 files changed, 36 insertions, 10 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 8ddd0d52..42b759b5 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -73,6 +73,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
73 73
74 // Properties that require element planes to be updated 74 // Properties that require element planes to be updated
75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false }, 75 _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false },
76 _recalculateScrollOffsets : { value: false },
76 77
77 /////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////
78 // Property accessors 79 // Property accessors
@@ -117,7 +118,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
117 }, 118 },
118 119
119 initializeFromDocument:{ 120 initializeFromDocument:{
120 value:function(adjustScrollOffsets){ 121 value:function(adjustScrollOffsets, useStageValues){
121 var i, 122 var i,
122 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), 123 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
123 stage = this.application.ninja.stage, 124 stage = this.application.ninja.stage,
@@ -141,6 +142,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
141 t, 142 t,
142 plane, 143 plane,
143 elt; 144 elt;
145 if(useStageValues) {
146 initL = stage.userPaddingLeft;
147 initT = stage.userPaddingTop;
148 this._recalculateScrollOffsets = false;
149 }
144 for(i=0; i<len; i++) { 150 for(i=0; i<len; i++) {
145 elt = documentRootChildren[i]; 151 elt = documentRootChildren[i];
146 plane = this.addElement(elt); 152 plane = this.addElement(elt);
@@ -149,17 +155,19 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
149 t = plane._rect.m_top - docTop; 155 t = plane._rect.m_top - docTop;
150 if(l < minLeft) { 156 if(l < minLeft) {
151 minLeft = l; 157 minLeft = l;
158 stage.minLeftElement = elt;
152 } 159 }
153 if(t < minTop) { 160 if(t < minTop) {
154 minTop = t; 161 minTop = t;
162 stage.minTopElement = elt;
155 } 163 }
156 } 164 }
157 } 165 }
158 if(minLeft !== initL) { 166 if(minLeft !== initL) {
159 stage.userPaddingLeft = minLeft; 167 stage.userPaddingLeft = (minLeft < 0) ? minLeft : 0;
160 } 168 }
161 if(minTop !== initT) { 169 if(minTop !== initT) {
162 stage.userPaddingTop = minTop; 170 stage.userPaddingTop = (minTop < 0) ? minTop : 0;
163 } 171 }
164 } 172 }
165 } 173 }
@@ -274,9 +282,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
274 t, 282 t,
275 plane, 283 plane,
276 changed = false, 284 changed = false,
285 elt,
277 adjustStagePadding = !isChanging || (event.detail.data.prop !== "matrix"); 286 adjustStagePadding = !isChanging || (event.detail.data.prop !== "matrix");
278 for(var i=0; i < len; i++) { 287 for(var i=0; i < len; i++) {
279 plane = els[i].elementModel.props3D.elementPlane; 288 elt = els[i];
289 plane = elt.elementModel.props3D.elementPlane;
280 if(plane) { 290 if(plane) {
281 plane.init(); 291 plane.init();
282 if(adjustStagePadding) { 292 if(adjustStagePadding) {
@@ -284,22 +294,34 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
284 t = plane._rect.m_top - docTop; 294 t = plane._rect.m_top - docTop;
285 if(l < minLeft) { 295 if(l < minLeft) {
286 minLeft = l; 296 minLeft = l;
297 stage.minLeftElement = elt;
298 } else if((elt === stage.minLeftElement) && (l > minLeft)) {
299 this._recalculateScrollOffsets = true;
287 } 300 }
301
288 if(t < minTop) { 302 if(t < minTop) {
289 minTop = t; 303 minTop = t;
304 stage.minTopElement = elt;
305 } else if((elt === stage.minTopElement) && (t > minTop)) {
306 this._recalculateScrollOffsets = true;
290 } 307 }
291 } 308 }
292 } 309 }
293 } 310 }
294 311
295 if(adjustStagePadding) { 312 if(adjustStagePadding) {
296 if(minLeft !== stage.userPaddingLeft) { 313 if(this._recalculateScrollOffsets && !isChanging) {
297 stage.userPaddingLeft = minLeft; 314 this.initializeFromDocument(true, true);
298 changed = true;
299 }
300 if(minTop !== stage.userPaddingTop) {
301 stage.userPaddingTop = minTop;
302 changed = true; 315 changed = true;
316 } else {
317 if(minLeft !== stage.userPaddingLeft) {
318 stage.userPaddingLeft = minLeft;
319 changed = true;
320 }
321 if(minTop !== stage.userPaddingTop) {
322 stage.userPaddingTop = minTop;
323 changed = true;
324 }
303 } 325 }
304 } 326 }
305 327
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index fce73882..3552935d 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -279,6 +279,10 @@ exports.Stage = Montage.create(Component, {
279 _userPaddingLeft: { value: 0 }, 279 _userPaddingLeft: { value: 0 },
280 _userPaddingTop: { value: 0 }, 280 _userPaddingTop: { value: 0 },
281 281
282 // keep track of the elements that determine the minimum left and top scrollable amount
283 minLeftElement: { value: null },
284 minTopElement: { value: null },
285
282 userPaddingLeft: { 286 userPaddingLeft: {
283 get: function() { return this._userPaddingLeft; }, 287 get: function() { return this._userPaddingLeft; },
284 set: function(value) { 288 set: function(value) {