diff options
author | Jon Reid | 2012-06-15 10:10:41 -0700 |
---|---|---|
committer | Jon Reid | 2012-06-15 10:10:41 -0700 |
commit | 526ac54f73d53e1e2a3d6a4dbf4f9992c143baf7 (patch) | |
tree | 65939e59615aaa10a7db77211e71616ad531bd0e /js/stage | |
parent | b5b760ee82e5cc4da176914983a6002cbf86c11a (diff) | |
parent | 5ee0c89fa0c7acc280ff3b884767e8513fd0b315 (diff) | |
download | ninja-526ac54f73d53e1e2a3d6a4dbf4f9992c143baf7.tar.gz |
Merge remote-tracking branch 'ninja-internal/master' into test-merge
Conflicts:
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/layout.js | 17 | ||||
-rwxr-xr-x | js/stage/stage-deps.js | 5 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 265 |
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 | ||
18 | exports.Layout = Montage.create(Component, { | 18 | exports.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 | ||
16 | exports.StageDeps = Montage.create(Component, { | 16 | exports.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 30ee1e40..fce73882 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 | ||
12 | exports.Stage = Montage.create(Component, { | 12 | exports.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 }, |
@@ -22,7 +27,10 @@ exports.Stage = Montage.create(Component, { | |||
22 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, | 27 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, |
23 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, | 28 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, |
24 | 29 | ||
25 | _iframeContainer: { value: null }, | 30 | _iframeContainer: { |
31 | value: null, | ||
32 | serializable: true | ||
33 | }, | ||
26 | 34 | ||
27 | _scrollFlag: {value: true, writable: true}, | 35 | _scrollFlag: {value: true, writable: true}, |
28 | outFlag: { value: false, writable: true }, | 36 | outFlag: { value: false, writable: true }, |
@@ -88,29 +96,82 @@ exports.Stage = Montage.create(Component, { | |||
88 | }, | 96 | }, |
89 | 97 | ||
90 | /** MAIN CANVASES **/ | 98 | /** MAIN CANVASES **/ |
91 | _canvas: { value: null }, // selection bounds, 3d normals and the overall 3d selection box use this canvas | 99 | // selection bounds, 3d normals and the overall 3d selection box use this canvas |
92 | canvas: { get: function() { return this._canvas; } }, | 100 | _canvas: { |
101 | value: null, | ||
102 | serializable: true | ||
103 | }, | ||
104 | |||
105 | canvas: { | ||
106 | get: function() { | ||
107 | return this._canvas; | ||
108 | } | ||
109 | }, | ||
93 | 110 | ||
94 | _context: { value: null }, | 111 | _context: { value: null }, |
95 | context: { get: function() { return this._context; } }, | 112 | context: { get: function() { return this._context; } }, |
96 | 113 | ||
97 | _layoutCanvas: { value: null }, | 114 | _layoutCanvas: { |
98 | layoutCanvas: { get: function() { return this._layoutCanvas; } }, | 115 | value: null, |
116 | serializable: true | ||
117 | }, | ||
99 | 118 | ||
100 | _gridCanvas: { value: null }, | 119 | layoutCanvas: { |
101 | gridCanvas: { get: function() { return this._gridCanvas; } }, | 120 | get: function() { |
121 | return this._layoutCanvas; | ||
122 | } | ||
123 | }, | ||
124 | |||
125 | _gridCanvas: { | ||
126 | value: null, | ||
127 | serializable: true | ||
128 | }, | ||
129 | |||
130 | gridCanvas: { | ||
131 | get: function() { | ||
132 | return this._gridCanvas; | ||
133 | } | ||
134 | }, | ||
102 | 135 | ||
103 | _gridContext: { value: null }, | 136 | _gridContext: { value: null }, |
104 | gridContext: { get: function() { return this._gridContext; } }, | 137 | gridContext: { get: function() { return this._gridContext; } }, |
105 | 138 | ||
106 | _drawingCanvas: { value: null }, | 139 | _drawingCanvas: { |
107 | drawingCanvas: { get: function() { return this._drawingCanvas; } }, | 140 | value: null, |
141 | serializable: true | ||
142 | }, | ||
143 | |||
144 | drawingCanvas: { | ||
145 | get: function() { | ||
146 | return this._drawingCanvas; | ||
147 | } | ||
148 | }, | ||
108 | 149 | ||
109 | _drawingContext: { value: null }, | 150 | _drawingContext: { value: null }, |
110 | drawingContext: { get: function() { return this._drawingContext; } }, | 151 | drawingContext: { get: function() { return this._drawingContext; } }, |
111 | 152 | ||
112 | _clickPoint: { value: { x: { value: null }, y: { value: null } } }, | 153 | _clickPoint: { value: { x: { value: null }, y: { value: null } } }, |
113 | 154 | ||
155 | stageDeps: { | ||
156 | value: null, | ||
157 | serializable: true | ||
158 | }, | ||
159 | |||
160 | layout: { | ||
161 | value: null, | ||
162 | serializable: true | ||
163 | }, | ||
164 | |||
165 | textTool: { | ||
166 | value: null, | ||
167 | serializable: true | ||
168 | }, | ||
169 | |||
170 | focusManager: { | ||
171 | value: null, | ||
172 | serializable: true | ||
173 | }, | ||
174 | |||
114 | // We will set this to false while moving objects to improve performance | 175 | // We will set this to false while moving objects to improve performance |
115 | showSelectionBounds: { value: true }, | 176 | showSelectionBounds: { value: true }, |
116 | 177 | ||
@@ -182,6 +243,13 @@ exports.Stage = Montage.create(Component, { | |||
182 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { | 243 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { |
183 | this.currentDocument.model.scrollLeft = this._scrollLeft; | 244 | this.currentDocument.model.scrollLeft = this._scrollLeft; |
184 | this.currentDocument.model.scrollTop = this._scrollTop; | 245 | this.currentDocument.model.scrollTop = this._scrollTop; |
246 | this.currentDocument.model.userPaddingLeft = this._userPaddingLeft; | ||
247 | this.currentDocument.model.userPaddingTop = this._userPaddingTop; | ||
248 | this.currentDocument.model.documentOffsetLeft = this._documentOffsetLeft; | ||
249 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; | ||
250 | this.currentDocument.model.userContentLeft = this._userContentLeft; | ||
251 | this.currentDocument.model.userContentTop = this._userContentTop; | ||
252 | |||
185 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | 253 | //call configure false with the old document on the selected tool to tear down down any temp. stuff |
186 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | 254 | this.application.ninja.toolsData.selectedToolInstance._configure(false); |
187 | } | 255 | } |
@@ -277,9 +345,6 @@ exports.Stage = Montage.create(Component, { | |||
277 | 345 | ||
278 | this.eventManager.addEventListener( "appMouseUp", this, false); | 346 | this.eventManager.addEventListener( "appMouseUp", this, false); |
279 | 347 | ||
280 | |||
281 | this.eventManager.addEventListener( "openDocument", this, false); | ||
282 | this.eventManager.addEventListener( "switchDocument", this, false); | ||
283 | this.eventManager.addEventListener( "enableStageMove", this, false); | 348 | this.eventManager.addEventListener( "enableStageMove", this, false); |
284 | this.eventManager.addEventListener( "disableStageMove", this, false); | 349 | this.eventManager.addEventListener( "disableStageMove", this, false); |
285 | 350 | ||
@@ -287,19 +352,9 @@ exports.Stage = Montage.create(Component, { | |||
287 | this.eventManager.addEventListener( "elementChanging", this, false); | 352 | this.eventManager.addEventListener( "elementChanging", this, false); |
288 | this.eventManager.addEventListener( "elementChange", this, false); | 353 | this.eventManager.addEventListener( "elementChange", this, false); |
289 | 354 | ||
290 | } | 355 | this.addPropertyChangeListener("currentDocument.model.domContainer", this, true); |