aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-deps.js6
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js50
-rwxr-xr-xjs/stage/stage.reel/stage.html3
-rwxr-xr-xjs/stage/stage.reel/stage.js73
4 files changed, 83 insertions, 49 deletions
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index 33ba2359..1825eb06 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -95,12 +95,6 @@ exports.StageDeps = Montage.create(Component, {
95 handleAppLoaded: { 95 handleAppLoaded: {
96 value: function() { 96 value: function() {
97 97
98 Object.defineBinding(this, "currentDocument", {
99 boundObject: this.application.ninja,
100 boundObjectPropertyPath: "currentDocument",
101 oneway: true
102 });
103
104 Object.defineBinding(this, "userContentLeft", { 98 Object.defineBinding(this, "userContentLeft", {
105 boundObject: this.stage, 99 boundObject: this.stage,
106 boundObjectPropertyPath: "_userContentLeft", 100 boundObjectPropertyPath: "_userContentLeft",
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 518c3bdd..ba94fadf 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -25,32 +25,12 @@ exports.StageView = Montage.create(Component, {
25 } 25 }
26 }, 26 },
27 27
28 templateDidLoad: {
29 value: function() {
30 this.eventManager.addEventListener("appLoaded", this, false);
31 }
32 },
33
34 didDraw:{ 28 didDraw:{
35 value: function() { 29 value: function() {
36 if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element; 30 if(!this.application.ninja.documentController._textHolder) this.application.ninja.documentController._textHolder = this.element;
37 } 31 }
38 }, 32 },
39 33
40 handleAppLoaded: {
41 value: function() {
42
43 // Don't bind for now
44 /*
45 Object.defineBinding(this, "docs", {
46 boundObject: this.application.ninja.documentController,
47 boundObjectPropertyPath: "_documents"
48 });
49 */
50
51 }
52 },
53
54 /** 34 /**
55 * Public method 35 * Public method
56 * Creates a textarea element which will contain the content of the opened text document. 36 * Creates a textarea element which will contain the content of the opened text document.
@@ -140,7 +120,22 @@ exports.StageView = Montage.create(Component, {
140 } 120 }
141 121
142 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 122 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
143 this.application.ninja.documentController._showCurrentDocument(); 123
124
125// this.application.ninja.documentController._showCurrentDocument();
126 // Inline function below
127 if(this.activeDocument) {
128 this.activeDocument.container.style["display"] = "block";
129 if(this.activeDocument.currentView === "design"){
130 this.activeDocument.container.parentNode.style["display"] = "block";
131 this.activeDocument.restoreAppState();
132 } else {
133 //hide the iframe when switching to code view
134 document.getElementById("iframeContainer").style.display = "none";
135 }
136 }
137
138
144 //focus editor 139 //focus editor
145 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ 140 if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){
146 this.application.ninja.documentController.activeDocument.editor.focus(); 141 this.application.ninja.documentController.activeDocument.editor.focus();
@@ -172,17 +167,6 @@ exports.StageView = Montage.create(Component, {
172 } 167 }
173 }, 168 },
174 169
175 hideOtherDocuments:{
176 value:function(docUuid){
177 this.application.ninja.documentController._documents.forEach(function(aDoc){
178 if(aDoc.currentView === "design"){
179 aDoc.container.parentNode.style["display"] = "none";
180 }else if((aDoc.currentView === "code") && (aDoc.uuid !== docUuid)){
181 aDoc.container.style["display"] = "none";
182 }
183 }, this);
184 }
185 },
186 showRulers:{ 170 showRulers:{
187 value:function(){ 171 value:function(){
188 this.application.ninja.rulerTop.style.display = "block"; 172 this.application.ninja.rulerTop.style.display = "block";
@@ -200,7 +184,7 @@ exports.StageView = Montage.create(Component, {
200 if(isCodeView === true) { 184 if(isCodeView === true) {
201 this.application.ninja.editorViewOptions.element.style.display = "block"; 185 this.application.ninja.editorViewOptions.element.style.display = "block";
202 this.application.ninja.documentBar.element.style.display = "none"; 186 this.application.ninja.documentBar.element.style.display = "none";
203 }else{ 187 } else {
204 this.application.ninja.documentBar.element.style.display = "block"; 188 this.application.ninja.documentBar.element.style.display = "block";
205 this.application.ninja.editorViewOptions.element.style.display = "none"; 189 this.application.ninja.editorViewOptions.element.style.display = "none";
206 } 190 }
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html
index 30c3d231..88cd6149 100755
--- a/js/stage/stage.reel/stage.html
+++ b/js/stage/stage.reel/stage.html
@@ -22,6 +22,9 @@
22 "prototype": "js/stage/stage-deps", 22 "prototype": "js/stage/stage-deps",
23 "properties": { 23 "properties": {
24 "stage": {"@": "owner"} 24 "stage": {"@": "owner"}
25 },
26 "bindings": {
27 "currentDocument": {"<-": "@owner.activeDocument"}
25 } 28 }
26 }, 29 },
27 30
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index deed4112..cac99326 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -164,6 +164,60 @@ exports.Stage = Montage.create(Component, {
164 set: function(value) { this._userContentBorder = value; } 164 set: function(value) { this._userContentBorder = value; }
165 }, 165 },
166 166
167 _activeDocument : {
168 value : null,
169 enumerable : false
170 },
171
172 activeDocument : {
173 get : function() {
174 return this._activeDocument;
175 },
176 set : function(document) {
177 ///// If the document is null set default stylesheets to null
178
179 if(!document) {
180 return false;
181 }
182
183 ///// setting document via binding
184 this._activeDocument = document;
185
186 },
187 enumerable : false
188 },
189
190 _userPaddingLeft: { value: 0 },
191 _userPaddingTop: { value: 0 },
192
193 userPaddingLeft: {
194 get: function() { return this._userPaddingLeft; },
195 set: function(value) {
196 this._userPaddingLeft = value;
197 this._documentOffsetLeft = -value;
198 if(!this._documentRoot) {
199 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
200 }
201 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px";
202 this.userContentLeft = this._documentOffsetLeft;
203 this.updatedStage = true;
204 }
205 },
206
207 userPaddingTop: {
208 get: function() { return this._userPaddingTop; },
209 set: function(value) {
210 this._userPaddingTop = value;
211 this._documentOffsetTop = -value;
212 if(!this._documentRoot) {
213 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
214 }
215 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px";
216 this.userContentTop = this._documentOffsetTop;
217 this.updatedStage = true;
218 }
219 },
220
167 willDraw: { 221 willDraw: {
168 value: function() { 222 value: function() {
169 if(this.resizeCanvases) { 223 if(this.resizeCanvases) {
@@ -264,8 +318,8 @@ exports.Stage = Montage.create(Component, {
264 318
265 this._scrollLeft = 0; 319 this._scrollLeft = 0;
266 this._scrollTop = 0; 320 this._scrollTop = 0;
267 this._userContentLeft = 0; 321 this._userContentLeft = this._documentOffsetLeft;
268 this._userContentTop = 0; 322 this._userContentTop = this._documentOffsetTop;
269 323
270 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11; 324 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
271 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11; 325 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
@@ -277,7 +331,7 @@ exports.Stage = Montage.create(Component, {
277 // TODO - We will need to modify this once we support switching between multiple documents 331 // TODO - We will need to modify this once we support switching between multiple documents
278 this.application.ninja.toolsData.selectedToolInstance._configure(true); 332 this.application.ninja.toolsData.selectedToolInstance._configure(true);
279 333
280 this.addEventListener("change@appModel.show3dGrid", this, false); 334 this.addPropertyChangeListener("appModel.show3dGrid", this, false);
281 335
282 this.layout.handleOpenDocument(); 336 this.layout.handleOpenDocument();
283 } 337 }
@@ -286,10 +340,9 @@ exports.Stage = Montage.create(Component, {
286 /** 340 /**
287 * Event handler for the change @ 3DGrid 341 * Event handler for the change @ 3DGrid
288 */ 342 */
289 handleEvent: { 343 handleChange: {
290 value: function(e) { 344 value: function(notification) {
291 if(e.type === "change@appModel.show3dGrid") { 345 if("appModel.show3dGrid" === notification.currentPropertyPath) {