aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/stage/stage-deps.js10
-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.js116
5 files changed, 117 insertions, 64 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 0a76dbe5..9c5e2167 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -156,7 +156,7 @@ exports.Layout = Montage.create(Component, {
156 drawTagOutline: { 156 drawTagOutline: {
157 value: function (item) { 157 value: function (item) {
158 158
159 if(!item || (item.nodeType !== 1)) return; 159 if(!item || !this.application.ninja.selectionController.isNodeTraversable(item)) return;
160 160
161 // TODO Bind the layoutview mode to the current document 161 // TODO Bind the layoutview mode to the current document
162 // var mode = this.application.ninja.currentDocument.layoutMode; 162 // var mode = this.application.ninja.currentDocument.layoutMode;
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index a71b77be..1825eb06 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -52,7 +52,7 @@ exports.StageDeps = Montage.create(Component, {
52 userContentLeft: { 52 userContentLeft: {
53 get: function() { return this._userContentLeft; }, 53 get: function() { return this._userContentLeft; },
54 set: function(value) { 54 set: function(value) {
55 if(value) { 55 if(value != null) {
56 viewUtils.setUserContentLeft(value); 56 viewUtils.setUserContentLeft(value);
57 } 57 }
58 } 58 }
@@ -65,7 +65,7 @@ exports.StageDeps = Montage.create(Component, {
65 userContentTop: { 65 userContentTop: {
66 get: function() { return this._userContentTop; }, 66 get: function() { return this._userContentTop; },
67 set: function(value) { 67 set: function(value) {
68 if(value) { 68 if(value != null) {
69 viewUtils.setUserContentTop(value); 69 viewUtils.setUserContentTop(value);
70 } 70 }
71 } 71 }
@@ -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 b181dc70..cac99326 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -118,6 +118,9 @@ exports.Stage = Montage.create(Component, {
118 _userContentTop: { value: 0 }, 118 _userContentTop: { value: 0 },
119 _userContentBorder: { value: 0 }, 119 _userContentBorder: { value: 0 },
120 120
121 _maxHorizontalScroll: { value: 0 },
122 _maxVerticalScroll: { value: 0 },
123
121 documentRoot: { 124 documentRoot: {
122 get: function () { return this._documentRoot; }, 125 get: function () { return this._documentRoot; },
123 set: function(value) { this._documentRoot = value; } 126 set: function(value) { this._documentRoot = value; }
@@ -161,6 +164,60 @@ exports.Stage = Montage.create(Component, {
161 set: function(value) { this._userContentBorder = value; } 164 set: function(value) { this._userContentBorder = value; }
162 }, 165 },
163 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 =