aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-16 15:56:54 -0700
committerNivesh Rajbhandari2012-05-16 15:56:54 -0700
commit727ad95f6828821f0682aa98104783e4bbda78b4 (patch)
tree9fec70e89ca02ac7c205da34522999c3ba729777
parentffea71abfac12d99b106b5c250ec77d5f14ff88e (diff)
downloadninja-727ad95f6828821f0682aa98104783e4bbda78b4.tar.gz
Inline style for html's padding for content in negative space to guarantee highest specificity. Also, set up scrollbars when opening files with content in negative space.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js35
-rwxr-xr-xjs/stage/stage.reel/stage.js16
2 files changed, 40 insertions, 11 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index b268b8f0..a6d2d899 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -119,19 +119,43 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
119 119
120 initializeFromDocument:{ 120 initializeFromDocument:{
121 value:function(){ 121 value:function(){
122 var documentRootChildren = null, i; 122 var documentRootChildren = null, i, stage = this.application.ninja.stage;
123 //initialize with current document 123 //initialize with current document
124 this._eltArray = []; 124 this._eltArray = [];
125 this._planesArray = []; 125 this._planesArray = [];
126 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); 126 this.setDrawingSurfaceElement(stage.canvas);
127 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); 127 this.setSourceSpaceElement( stage.stageDeps.currentStage );
128 this.setWorkingPlane( [0,0,1,0] ); 128 this.setWorkingPlane( [0,0,1,0] );
129 129
130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
131 if(this.application.ninja.currentDocument._liveNodeList.length > 0){ 131 if(this.application.ninja.currentDocument._liveNodeList.length > 0){
132 documentRootChildren = this.application.ninja.currentDocument._liveNodeList; 132 documentRootChildren = this.application.ninja.currentDocument._liveNodeList;
133 for(i=0;i<documentRootChildren.length;i++){ 133 var len = documentRootChildren.length,
134 this.addElement(documentRootChildren[i]); 134 minLeft = stage.userPaddingLeft,
135 minTop = stage.userPaddingTop,
136 docLeft = stage.documentOffsetLeft,
137 docTop = stage.documentOffsetTop,
138 l,
139 t,
140 plane,
141 elt
142 for(i=0; i<len; i++) {
143 elt = documentRootChildren[i];
144 plane = this.addElement(elt);
145 l = plane._rect.m_left - docLeft;
146 t = plane._rect.m_top - docTop;
147 if(l < minLeft) {
148 minLeft = l;
149 }
150 if(t < minTop) {
151 minTop = t;
152 }
153 }
154 if(minLeft !== stage.userPaddingLeft) {
155 stage.userPaddingLeft = minLeft;
156 }
157 if(minTop !== stage.userPaddingTop) {
158 stage.userPaddingTop = minTop;
135 } 159 }
136 } 160 }
137 } 161 }
@@ -310,6 +334,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
310 plane.init(); 334 plane.init();
311 this._planesArray.push( plane ); 335 this._planesArray.push( plane );
312 elt.elementModel.props3D.elementPlane = plane; 336 elt.elementModel.props3D.elementPlane = plane;
337 return plane;
313 } 338 }
314 }, 339 },
315 340
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 854b5a2d..28356d1a 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -195,8 +195,10 @@ exports.Stage = Montage.create(Component, {
195 set: function(value) { 195 set: function(value) {
196 this._userPaddingLeft = value; 196 this._userPaddingLeft = value;
197 this._documentOffsetLeft = -value; 197 this._documentOffsetLeft = -value;
198 this.application.ninja.stylesController.setElementStyle(this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0], 198 if(!this._documentRoot) {
199 "padding-left", -value + "px", true); 199 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
200 }
201 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px";
200 this.userContentLeft = this._documentOffsetLeft; 202 this.userContentLeft = this._documentOffsetLeft;
201 this.updatedStage = true; 203 this.updatedStage = true;
202 } 204 }
@@ -207,8 +209,10 @@ exports.Stage = Montage.create(Component, {
207 set: function(value) { 209 set: function(value) {
208 this._userPaddingTop = value; 210 this._userPaddingTop = value;
209 this._documentOffsetTop = -value; 211 this._documentOffsetTop = -value;
210 this.application.ninja.stylesController.setElementStyle(this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0], 212 if(!this._documentRoot) {
211 "padding-top", -value + "px", true); 213 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
214 }
215 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px";
212 this.userContentTop = this._documentOffsetTop; 216 this.userContentTop = this._documentOffsetTop;
213 this.updatedStage = true; 217 this.updatedStage = true;
214 } 218 }
@@ -314,8 +318,8 @@ exports.Stage = Montage.create(Component, {
314 318
315 this._scrollLeft = 0; 319 this._scrollLeft = 0;
316 this._scrollTop = 0; 320 this._scrollTop = 0;
317 this._userContentLeft = 0; 321 this._userContentLeft = this._documentOffsetLeft;
318 this._userContentTop = 0; 322 this._userContentTop = this._documentOffsetTop;
319 323
320 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11; 324 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
321 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11; 325 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;