aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/document-html.js2
-rwxr-xr-xjs/document/views/design.js42
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js19
-rwxr-xr-xjs/helper-classes/3D/view-utils.js13
-rwxr-xr-xjs/stage/layout.js11
-rwxr-xr-xjs/stage/stage-deps.js50
-rwxr-xr-xjs/stage/stage.reel/stage.js60
7 files changed, 95 insertions, 102 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index f92a425c..2fc32791 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -98,7 +98,7 @@ exports.HtmlDocument = Montage.create(Component, {
98 this.documentRoot = this.model.views.design.document.body; 98 this.documentRoot = this.model.views.design.document.body;
99 } 99 }
100 //TODO: Why is this needed? 100 //TODO: Why is this needed?
101 this._liveNodeList = this.documentRoot.getElementsByTagName('*'); 101 this.model.views.design._liveNodeList = this.documentRoot.getElementsByTagName('*');
102 //Initiliazing document model 102 //Initiliazing document model
103 document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body"); 103 document.application.njUtils.makeElementModel(this.documentRoot, "Body", "body");
104 //Adding observer to know when template is ready 104 //Adding observer to know when template is ready
diff --git a/js/document/views/design.js b/js/document/views/design.js
index b3887fdf..427ef706 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -67,8 +67,44 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
67 propertiesPanel: { 67 propertiesPanel: {
68 value: null 68 value: null
69 }, 69 },
70
70 //////////////////////////////////////////////////////////////////// 71 ////////////////////////////////////////////////////////////////////
71 // 72 //
73 _liveNodeList: {
74 value: null
75 },
76
77 getLiveNodeList: {
78 value: function(useFilter) {
79 if(useFilter) {
80 var filteredNodes = [],
81 childNodes = Array.prototype.slice.call(this._liveNodeList, 0);
82
83 childNodes.forEach(function(item) {
84 if( (item.nodeType === 1) && (item.nodeName !== "STYLE") && (item.nodeName !== "SCRIPT")) {
85 filteredNodes.push(item);
86 }
87 });
88 return filteredNodes;
89 } else {
90 return this._liveNodeList;
91 }
92 }
93 },
94 ////////////////////////////////////////////////////////////////////
95 //
96
97 initialPaddingLeft: {
98 value: 0
99 },
100
101 initialPaddingTop: {
102 value: 0
103 },
104 ////////////////////////////////////////////////////////////////////
105 //
106
107 //
72 initialize: { 108 initialize: {
73 value: function (parent) { 109 value: function (parent) {
74 //Creating iFrame for view 110 //Creating iFrame for view
@@ -190,8 +226,10 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
190 //Calling standard method to finish opening document 226 //Calling standard method to finish opening document
191 this.bodyContentLoaded(null); 227 this.bodyContentLoaded(null);
192 //TODO: Move this to be set via the controller 228 //TODO: Move this to be set via the controller
193 this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2); 229// this.application.ninja.stage.documentOffsetLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2);
194 this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2); 230// this.application.ninja.stage.documentOffsetTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2);
231// this.initialPaddingLeft = parseInt((this.document.body.scrollWidth - this._template.size.width)/2);
232// this.initialPaddingTop = parseInt((this.document.body.scrollHeight - this._template.size.height)/2);
195 } 233 }
196 }, 234 },
197 //////////////////////////////////////////////////////////////////// 235 ////////////////////////////////////////////////////////////////////
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//
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 9c5e2167..107e8abf 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -64,10 +64,10 @@ exports.Layout = Montage.create(Component, {
64 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 64 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
65 this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes; 65 this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes;
66 } 66 }
67 67//
68 // Draw the elements and the 3d info 68// // Draw the elements and the 3d info
69 this.draw(); 69// this.draw();
70 this.draw3DInfo(false); 70// this.draw3DInfo(false);
71 } 71 }
72 }, 72 },
73 73
@@ -89,7 +89,8 @@ exports.Layout = Montage.create(Component, {
89 89
90 if(this.application.ninja.documentController.activeDocument.currentView === "design"){ 90 if(this.application.ninja.documentController.activeDocument.currentView === "design"){
91 // Make an array copy of the line node list which is not an array like object 91