diff options
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/layout.js | 39 | ||||
-rwxr-xr-x | js/stage/stage-deps.js | 31 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.html | 18 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 35 |
4 files changed, 87 insertions, 36 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js index 7b6e47e7..71296405 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js | |||
@@ -23,6 +23,30 @@ exports.Layout = Montage.create(Component, { | |||
23 | drawFillColor: { value: 'rgba(255,255,255,1)' }, | 23 | drawFillColor: { value: 'rgba(255,255,255,1)' }, |
24 | ctxLineWidth: { value: 0.2 }, | 24 | ctxLineWidth: { value: 0.2 }, |
25 | 25 | ||
26 | _currentDocument: { | ||
27 | value : null, | ||
28 | enumerable : false | ||
29 | }, | ||
30 | |||
31 | currentDocument : { | ||
32 | get : function() { | ||
33 | return this._currentDocument; | ||
34 | }, | ||
35 | set : function(value) { | ||
36 | if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | this._currentDocument = value; | ||
41 | |||
42 | if(!value) { | ||
43 | |||
44 | } else if(this._currentDocument.currentView === "design") { | ||
45 | this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; | ||
46 | } | ||
47 | } | ||
48 | }, | ||
49 | |||
26 | _layoutView: { | 50 | _layoutView: { |
27 | value: "layoutAll" | 51 | value: "layoutAll" |
28 | }, | 52 | }, |
@@ -58,15 +82,6 @@ exports.Layout = Montage.create(Component, { | |||
58 | } | 82 | } |
59 | }, | 83 | }, |
60 | 84 | ||
61 | handleOpenDocument: { | ||
62 | value: function() { | ||
63 | // Initial elements to draw are the childrens of the root element | ||
64 | if(this.application.ninja.documentController.activeDocument.currentView === "design") { | ||
65 | this.elementsToDraw = this.application.ninja.documentController.activeDocument.model.documentRoot.childNodes; | ||
66 | } | ||
67 | } | ||
68 | }, | ||
69 | |||
70 | // Redraw stage only once after all deletion is completed | 85 | // Redraw stage only once after all deletion is completed |
71 | handleElementsRemoved: { | 86 | handleElementsRemoved: { |
72 | value: function(event) { | 87 | value: function(event) { |
@@ -79,11 +94,11 @@ exports.Layout = Montage.create(Component, { | |||
79 | value: function(event) { | 94 | value: function(event) { |
80 | var containerIndex; | 95 | var containerIndex; |
81 | 96 | ||
82 | if(this.application.ninja.documentController.activeDocument === null){ | 97 | if(this.currentDocument === null){ |
83 | return; | 98 | return; |
84 | } | 99 | } |
85 | 100 | ||
86 | if(this.application.ninja.documentController.activeDocument.currentView === "design"){ | 101 | if(this.currentDocument.currentView === "design"){ |
87 | // Make an array copy of the line node list which is not an array like object | 102 | // Make an array copy of the line node list which is not an array like object |
88 | this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); | 103 | this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); |
89 | // Index of the current container | 104 | // Index of the current container |
@@ -218,7 +233,7 @@ exports.Layout = Montage.create(Component, { | |||
218 | if(this.layoutView === "layoutAll") { | 233 | if(this.layoutView === "layoutAll") { |
219 | this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke | 234 | this.ctx.strokeStyle = 'rgba(0,0,0,1)'; // Black Stroke |
220 | this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); | 235 | this.ctx.strokeRect(bounds3D[0][0]+5.5, bounds3D[0][1]-15.5, 70, 11); |
221 | this.ctx.fillStyle = 'rgba(255,255,255,1)' // White Fill | 236 | this.ctx.fillStyle = 'rgba(255,255,255,1)'; // White Fill |
222 | this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); | 237 | this.ctx.fillRect(bounds3D[0][0]+6, bounds3D[0][1]-15, 69, 10); |
223 | 238 | ||
224 | this.ctx.fillStyle = 'rgba(0,0,0,1)'; | 239 | this.ctx.fillStyle = 'rgba(0,0,0,1)'; |
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js index b45315b7..709c0201 100755 --- a/js/stage/stage-deps.js +++ b/js/stage/stage-deps.js | |||
@@ -14,6 +14,37 @@ var Montage = require("montage/core/core").Montage, | |||
14 | VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 14 | VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; |
15 | 15 | ||
16 | exports.StageDeps = Montage.create(Component, { | 16 | exports.StageDeps = Montage.create(Component, { |
17 | |||
18 | _currentDocument: { | ||
19 | value : null, | ||
20 | enumerable : false | ||
21 | }, | ||
22 | |||
23 | currentDocument : { | ||
24 | get : function() { | ||
25 | return this._currentDocument; | ||
26 | }, | ||
27 | set : function(value) { | ||
28 | if (value === this._currentDocument) { | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | this._currentDocument = value; | ||
33 | |||
34 | if(!value) { | ||
35 | |||
36 | } else if(this._currentDocument.currentView === "design") { | ||
37 | workingPlane = [0,0,1,0]; | ||
38 | |||
39 | snapManager._isCacheInvalid = true; | ||
40 | snapManager.setupDragPlaneFromPlane (workingPlane); | ||
41 | |||
42 | drawUtils.initializeFromDocument(); | ||
43 | } | ||
44 | |||
45 | } | ||
46 | }, | ||
47 | |||
17 | viewUtils: { | 48 | viewUtils: { |
18 | value: viewUtils | 49 | value: viewUtils |
19 | }, | 50 | }, |
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index a819fc79..1b5cec17 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html | |||
@@ -18,25 +18,25 @@ | |||
18 | } | 18 | } |
19 | }, | 19 | }, |
20 | 20 | ||
21 | "StageDeps1": { | 21 | "stageDeps": { |
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.currentDocument"} | ||
25 | } | 28 | } |
26 | }, | 29 | }, |
27 | 30 | ||
28 | "layout1": { | 31 | "layout": { |
29 | "prototype": "js/stage/layout", | 32 | "prototype": "js/stage/layout", |
30 | "properties": { | 33 | "properties": { |
31 | "canvas": {"#": "layoutCanvas"}, | 34 | "canvas": {"#": "layoutCanvas"}, |
32 | "stage": {"@": "owner"} | 35 | "stage": {"@": "owner"} |
33 | }, | 36 | }, |
34 | "bindings": { | 37 | "bindings": { |
35 | "layoutView": { | 38 | "layoutView": {"<-": "@owner.appModel.layoutView"}, |
36 | "boundObject": {"@": "owner" }, | 39 | "currentDocument": {"<-": "@owner.currentDocument"} |
37 | "boundObjectPropertyPath": "appModel.layoutView", | ||
38 | "oneway": true | ||
39 | } | ||
40 | } | 40 | } |
41 | }, | 41 | }, |
42 | 42 | ||
@@ -60,8 +60,8 @@ | |||
60 | "_gridCanvas": {"#": "gridCanvas"}, | 60 | "_gridCanvas": {"#": "gridCanvas"}, |
61 | "_canvas": {"#": "stageCanvas"}, | 61 | "_canvas": {"#": "stageCanvas"}, |
62 | "_drawingCanvas": {"#": "drawingCanvas"}, | 62 | "_drawingCanvas": {"#": "drawingCanvas"}, |
63 | "stageDeps": {"@": "StageDeps1"}, | 63 | "stageDeps": {"@": "stageDeps"}, |
64 | "layout": {"@": "layout1"}, | 64 | "layout": {"@": "layout"}, |
65 | "stageView": {"@": "stageView"}, | 65 | "stageView": {"@": "stageView"}, |
66 | "textTool": {"@": "textTool"}, | 66 | "textTool": {"@": "textTool"}, |
67 | "focusManager": {"@": "focusManager"} | 67 | "focusManager": {"@": "focusManager"} |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 7025c692..4505ff66 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -161,28 +161,35 @@ exports.Stage = Montage.create(Component, { | |||
161 | set: function(value) { this._userContentBorder = value; } | 161 | set: function(value) { this._userContentBorder = value; } |
162 | }, | 162 | }, |
163 | 163 | ||
164 | _activeDocument : { | 164 | _currentDocument: { |
165 | value : null, | 165 | value : null |
166 | enumerable : false | ||
167 | }, | 166 | }, |
168 | 167 | ||
169 | activeDocument : { | 168 | currentDocument : { |
170 | get : function() { | 169 | get : function() { |
171 | return this._activeDocument; | 170 | return this._currentDocument; |
172 | }, | 171 | }, |
173 | set : function(document) { | 172 | set : function(value) { |
174 | ///// If the document is null set default stylesheets to null | 173 | if (value === this._currentDocument) { |
174 | return; | ||
175 | } | ||
175 | 176 | ||
176 | if(!document) { | 177 | if(!this._currentDocument && value.currentView === "design") { |
177 | return false; | 178 | this.showRulers(); |
179 | this.hideCanvas(false); | ||
178 | } | 180 | } |
179 | 181 | ||
180 | ///// setting document via binding | 182 | this._currentDocument = value; |
181 | this._activeDocument = document; | ||
182 | 183 | ||
184 | if(!value) { | ||
185 | this.hideRulers(); | ||
186 | this.hideCanvas(true); | ||
187 | } else if(this._currentDocument.currentView === "design") { | ||
188 | this.clearAllCanvas(); | ||
189 | this.initWithDocument(false); | ||
190 | } | ||
191 | } | ||
183 | }, | 192 | }, |
184 | enumerable : false | ||
185 | }, | ||
186 | 193 | ||
187 | _userPaddingLeft: { value: 0 }, | 194 | _userPaddingLeft: { value: 0 }, |
188 | _userPaddingTop: { value: 0 }, | 195 | _userPaddingTop: { value: 0 }, |
@@ -283,8 +290,6 @@ exports.Stage = Montage.create(Component, { | |||
283 | value: function(didSwitch) { | 290 | value: function(didSwitch) { |
284 | var designView = this.application.ninja.currentDocument.model.views.design; | 291 | var designView = this.application.ninja.currentDocument.model.views.design; |
285 | 292 | ||
286 | this.hideCanvas(false); | ||
287 | |||
288 |