aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-23 16:09:22 -0700
committerNivesh Rajbhandari2012-05-23 16:09:22 -0700
commitf97590388467b5a3316f6f155162fc293915fddc (patch)
treea2888e65b53704caeb9f4f84d5a85dbdb19e4ff6 /js/helper-classes
parentf1dbf7c58e91a27c80f3a607e87ad122d803c500 (diff)
downloadninja-f97590388467b5a3316f6f155162fc293915fddc.tar.gz
Fixed scrolling and centering stage code. Also, moved liveNodeList into the design view and added an option to exclude styles and text nodes when retrieving the live nodes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js19
-rwxr-xr-xjs/helper-classes/3D/view-utils.js13
2 files changed, 14 insertions, 18 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bf48a723..79be5c14 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -119,7 +119,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
119 119
120 initializeFromDocument:{ 120 initializeFromDocument:{
121 value:function(){ 121 value:function(){
122 var documentRootChildren = null, i, stage = this.application.ninja.stage; 122 var i,
123 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
124 stage = this.application.ninja.stage,
125 len = documentRootChildren.length;
123 //initialize with current document 126 //initialize with current document
124 this._eltArray = []; 127 this._eltArray = [];
125 this._planesArray = []; 128 this._planesArray = [];
@@ -128,11 +131,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
128 this.setWorkingPlane( [0,0,1,0] ); 131 this.setWorkingPlane( [0,0,1,0] );
129 132
130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 133 //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){ 134 if(len > 0) {
132 documentRootChildren = this.application.ninja.currentDocument._liveNodeList; 135 var initL = 0,
133 var len = documentRootChildren.length, 136 initT = 0,
134 minLeft = stage.userPaddingLeft, 137 minLeft = 0,
135 minTop = stage.userPaddingTop, 138 minTop = 0,
136 docLeft = stage.documentOffsetLeft, 139 docLeft = stage.documentOffsetLeft,
137 docTop = stage.documentOffsetTop, 140 docTop = stage.documentOffsetTop,
138 l, 141 l,
@@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
151 minTop = t; 154 minTop = t;
152 } 155 }
153 } 156 }
154 if(minLeft !== stage.userPaddingLeft) { 157 if(minLeft !== initL) {
155 stage.userPaddingLeft = minLeft; 158 stage.userPaddingLeft = minLeft;
156 } 159 }
157 if(minTop !== stage.userPaddingTop) { 160 if(minTop !== initT) {
158 stage.userPaddingTop = minTop; 161 stage.userPaddingTop = minTop;
159 } 162 }
160 } 163 }
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 0080bf90..24b30298 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -24,9 +24,6 @@ exports.ViewUtils = Montage.create(Component, {
24 // keep a stack of viewport objects 24 // keep a stack of viewport objects
25 _viewportObjStack: { value: []}, 25 _viewportObjStack: { value: []},
26 26
27 _userContentLeft: { value: null},
28 _userContentTop: { value: null},
29
30 /////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////
31 // Property accessors 28 // Property accessors
32 /////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////
@@ -39,9 +36,6 @@ exports.ViewUtils = Montage.create(Component, {
39 }, 36 },
40 getViewportObj: { value: function() { return this.m_viewportObj; } }, 37 getViewportObj: { value: function() { return this.m_viewportObj; } },
41 38
42 setUserContentLeft: { value: function(value) { this._userContentLeft = value; }},
43 setUserContentTop: { value: function(value) { this._userContentTop = value; }},
44
45 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } }, 39 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } },
46 40
47 /////////////////////////////////////////////////////////////////////// 41 ///////////////////////////////////////////////////////////////////////
@@ -385,7 +379,7 @@ exports.ViewUtils = Montage.create(Component, {
385 // transform the bounds up the tree 379 // transform the bounds up the tree
386 var parent = child.offsetParent; 380 var parent = child.offsetParent;
387 // TODO - Should have a different way to check for new template mode 381 // TODO - Should have a different way to check for new template mode
388 if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) 382 if ( parent || (child === this.application.ninja.currentDocument.documentRoot) )
389 { 383 {
390 this.setViewportObj( child ); 384 this.setViewportObj( child );
391 385
@@ -703,8 +697,8 @@ exports.ViewUtils = Montage.create(Component, {
703 { 697 {
704 // TODO - Call a routine from the user document controller to get the offsets/margins 698 // TODO - Call a routine from the user document controller to get the offsets/margins
705 // Once we expose the document controller to ViewUtils 699 // Once we expose the document controller to ViewUtils
706 offset[0] += this._userContentLeft; 700 offset[0] += this.application.ninja.stage._userContentLeft;
707 offset[1] += this._userContentTop; 701 offset[1] += this.application.ninja.stage._userContentTop;
708 } 702 }
709 703
710 return offset; 704 return offset;
@@ -1282,7 +1276,6 @@ exports.ViewUtils = Montage.create(Component, {
1282// stageManager._canvas: this.application.ninja.stage.canvas 1276// stageManager._canvas: this.application.ninja.stage.canvas
1283// stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas 1277// stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas
1284// stageManager.drawingCanvas: this.application.ninja.stage.drawingCanvas 1278// stageManager.drawingCanvas: this.application.ninja.stage.drawingCanvas
1285// stageManager.userContentLeft this.application.ninja.stage.userContentLeft
1286// viewUtils: stage.viewUtils; 1279// viewUtils: stage.viewUtils;
1287// snapManager stage.snapManager; 1280// snapManager stage.snapManager;
1288// 1281//