aboutsummaryrefslogtreecommitdiff
path: root/js/document
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/document
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/document')
-rwxr-xr-xjs/document/document-html.js2
-rwxr-xr-xjs/document/views/design.js42
2 files changed, 41 insertions, 3 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 ////////////////////////////////////////////////////////////////////