aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-19 01:03:59 -0700
committerArmen Kesablyan2012-06-19 01:03:59 -0700
commit2e13a73e4ee980a6f73f6ff48b2a195eb209a7db (patch)
treed352f5e769eae0e1b7b76ccbeafa9b174b1a9918 /js/stage
parent244e608645778746d1a3b5aa0d4c0868f7c5c272 (diff)
parentc59eb371559a3061ce53223e249ca97daace5968 (diff)
downloadninja-2e13a73e4ee980a6f73f6ff48b2a195eb209a7db.tar.gz
Merge branch 'refs/heads/master' into binding
Conflicts: js/components/layout/tools-list.reel/tools-list.html js/components/layout/tools-properties.reel/tools-properties.html js/document/document-html.js js/document/templates/app/main.js js/panels/Panel.reel/Panel.js node_modules/montage/ui/native-control.js Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js17
-rwxr-xr-xjs/stage/stage-deps.js5
-rwxr-xr-xjs/stage/stage.reel/stage.js265
3 files changed, 239 insertions, 48 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 71296405..28484b71 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -17,7 +17,16 @@ var Montage = require("montage/core/core").Montage,
17 17
18exports.Layout = Montage.create(Component, { 18exports.Layout = Montage.create(Component, {
19 19
20 canvas: { value: null }, 20 canvas: {
21 value: null,
22 serializable: true
23 },
24
25 stage: {
26 value: null,
27 serializable: true
28 },
29
21 ctx: { value: null }, 30 ctx: { value: null },
22 31
23 drawFillColor: { value: 'rgba(255,255,255,1)' }, 32 drawFillColor: { value: 'rgba(255,255,255,1)' },
@@ -102,11 +111,11 @@ exports.Layout = Montage.create(Component, {
102 // Make an array copy of the line node list which is not an array like object 111 // Make an array copy of the line node list which is not an array like object
103 this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true); 112 this.domTree = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true);
104 // Index of the current container 113 // Index of the current container
105 containerIndex = this.domTree.indexOf(this.application.ninja.currentSelectedContainer); 114 containerIndex = this.domTree.indexOf(this.currentDocument.model.domContainer);
106 115
107 if(containerIndex < 0) { 116 if(containerIndex < 0) {
108 // Stage is the container. 117 // Stage is the container.
109 this.domTree = Array.prototype.slice.call(this.application.ninja.currentSelectedContainer.childNodes, 0); 118 this.domTree = Array.prototype.slice.call(this.currentDocument.model.domContainer.childNodes, 0);
110 } else { 119 } else {
111 // Child nodes of the container 120 // Child nodes of the container
112 this.domTree = Array.prototype.slice.call(this.domTree[containerIndex].childNodes, 0); 121 this.domTree = Array.prototype.slice.call(this.domTree[containerIndex].childNodes, 0);
@@ -204,7 +213,7 @@ exports.Layout = Montage.create(Component, {
204 bounds3D[j] = tmpPt; 213 bounds3D[j] = tmpPt;
205 } 214 }
206 215
207 if(item.uuid === this.application.ninja.currentSelectedContainer.uuid) { 216 if(item.uuid === this.currentDocument.model.domContainer.uuid) {
208 this.ctx.save(); 217 this.ctx.save();
209 this.ctx.strokeStyle = "#C61F00"; 218 this.ctx.strokeStyle = "#C61F00";
210 219
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index 762c2529..462f7ca5 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -15,6 +15,11 @@ var Montage = require("montage/core/core").Montage,
15 15
16exports.StageDeps = Montage.create(Component, { 16exports.StageDeps = Montage.create(Component, {
17 17
18 stage: {
19 value: null,
20 serializable: true
21 },
22
18 viewUtils: { 23 viewUtils: {
19 value: viewUtils 24 value: viewUtils
20 }, 25 },
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 63339c57..33c4fd22 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -11,6 +11,11 @@ var Montage = require("montage/core/core").Montage,
11 11
12exports.Stage = Montage.create(Component, { 12exports.Stage = Montage.create(Component, {
13 13
14 appModel: {
15 value: null,
16 serializable: true
17 },
18
14 // TODO - Need to figure out how to remove this dependency 19 // TODO - Need to figure out how to remove this dependency
15 // Needed by some tools that depend on selectionDrawn event to set up some logic 20 // Needed by some tools that depend on selectionDrawn event to set up some logic
16 drawNow: { value : false }, 21 drawNow: { value : false },
@@ -25,7 +30,10 @@ exports.Stage = Montage.create(Component, {
25 value: null 30 value: null
26 }, 31 },
27 32
28 _iframeContainer: { value: null }, 33 _iframeContainer: {
34 value: null,
35 serializable: true
36 },
29 37
30 _scrollFlag: {value: true, writable: true}, 38 _scrollFlag: {value: true, writable: true},
31 outFlag: { value: false, writable: true }, 39 outFlag: { value: false, writable: true },
@@ -91,29 +99,82 @@ exports.Stage = Montage.create(Component, {
91 }, 99 },
92 100
93 /** MAIN CANVASES **/ 101 /** MAIN CANVASES **/
94 _canvas: { value: null }, // selection bounds, 3d normals and the overall 3d selection box use this canvas 102 // selection bounds, 3d normals and the overall 3d selection box use this canvas
95 canvas: { get: function() { return this._canvas; } }, 103 _canvas: {
104 value: null,
105 serializable: true
106 },
107
108 canvas: {
109 get: function() {
110 return this._canvas;
111 }
112 },
96 113
97 _context: { value: null }, 114 _context: { value: null },
98 context: { get: function() { return this._context; } }, 115 context: { get: function() { return this._context; } },
99 116
100 _layoutCanvas: { value: null }, 117 _layoutCanvas: {
101 layoutCanvas: { get: function() { return this._layoutCanvas; } }, 118 value: null,
119 serializable: true
120 },
102 121
103 _gridCanvas: { value: null }, 122 layoutCanvas: {
104 gridCanvas: { get: function() { return this._gridCanvas; } }, 123 get: function() {
124 return this._layoutCanvas;
125 }
126 },
127
128 _gridCanvas: {
129 value: null,
130 serializable: true
131 },
132
133 gridCanvas: {
134 get: function() {
135 return this._gridCanvas;
136 }
137 },
105 138
106 _gridContext: { value: null }, 139 _gridContext: { value: null },
107 gridContext: { get: function() { return this._gridContext; } }, 140 gridContext: { get: function() { return this._gridContext; } },
108 141
109 _drawingCanvas: { value: null }, 142 _drawingCanvas: {
110 drawingCanvas: { get: function() { return this._drawingCanvas; } }, 143 value: null,
144 serializable: true
145 },
146
147 drawingCanvas: {
148 get: function() {
149 return this._drawingCanvas;
150 }
151 },
111 152
112 _drawingContext: { value: null }, 153 _drawingContext: { value: null },
113 drawingContext: { get: function() { return this._drawingContext; } }, 154 drawingContext: { get: function() { return this._drawingContext; } },
114 155
115 _clickPoint: { value: { x: { value: null }, y: { value: null } } }, 156 _clickPoint: { value: { x: { value: null }, y: { value: null } } },
116 157
158 stageDeps: {
159 value: null,
160 serializable: true
161 },
162
163 layout: {
164 value: null,
165 serializable: true
166 },
167
168 textTool: {
169 value: null,
170 serializable: true
171 },
172
173 focusManager: {
174 value: null,
175 serializable: true
176 },
177
117 // We will set this to false while moving objects to improve performance 178 // We will set this to false while moving objects to improve performance
118 showSelectionBounds: { value: true }, 179 showSelectionBounds: { value: true },
119 180
@@ -185,6 +246,13 @@ exports.Stage = Montage.create(Component, {
185 if(this.currentDocument && (this.currentDocument.currentView === "design")) { 246 if(this.currentDocument && (this.currentDocument.currentView === "design")) {
186 this.currentDocument.model.scrollLeft = this._scrollLeft; 247 this.currentDocument.model.scrollLeft = this._scrollLeft;
187 this.currentDocument.model.scrollTop = this._scrollTop; 248 this.currentDocument.model.scrollTop = this._scrollTop;
249 this.currentDocument.model.userPaddingLeft = this._userPaddingLeft;
250 this.currentDocument.model.userPaddingTop = this._userPaddingTop;
251 this.currentDocument.model.documentOffsetLeft = this._documentOffsetLeft;
252 this.currentDocument.model.documentOffsetTop = this._documentOffsetTop;
253 this.currentDocument.model.userContentLeft = this._userContentLeft;
254 this.currentDocument.model.userContentTop = this._userContentTop;
255
188 //call configure false with the old document on the selected tool to tear down down any temp. stuff 256 //call configure false with the old document on the selected tool to tear down down any temp. stuff
189 this.application.ninja.toolsData.selectedToolInstance._configure(false); 257 this.application.ninja.toolsData.selectedToolInstance._configure(false);
190 } 258 }
@@ -279,9 +347,6 @@ exports.Stage = Montage.create(Component, {
279 347
280 this.eventManager.addEventListener( "appMouseUp", this, false); 348 this.eventManager.addEventListener( "appMouseUp", this, false);
281 349
282
283 this.eventManager.addEventListener( "openDocument", this, false);
284 this.eventManager.addEventListener( "switchDocument", this, false);
285 this.eventManager.addEventListener( "enableStageMove", this, false); 350 this.eventManager.addEventListener( "enableStageMove", this, false);
286 this.eventManager.addEventListener( "disableStageMove", this, false); 351 this.eventManager.addEventListener( "disableStageMove", this, false);
287 352
@@ -289,19 +354,9 @@ exports.Stage = Montage.create(Component, {
289 this.eventManager.addEventListener( "elementChanging", this, false); 354 this.eventManager.addEventListener( "elementChanging", this, false);
290 this.eventManager.addEventListener( "elementChange", this, false); 355 this.eventManager.addEventListener( "elementChange", this, false);
291 356
292 } 357 this.addPropertyChangeListener("currentDocument.model.domContainer", this, true);
293