diff options
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/layout.js | 2 | ||||
-rwxr-xr-x | js/stage/stage-view.reel/stage-view.html | 5 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.html | 17 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 154 |
4 files changed, 90 insertions, 88 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js index a096848e..0a76dbe5 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js | |||
@@ -174,7 +174,7 @@ exports.Layout = Montage.create(Component, { | |||
174 | var tmpMat = viewUtils.getLocalToGlobalMatrix( item ); | 174 | var tmpMat = viewUtils.getLocalToGlobalMatrix( item ); |
175 | 175 | ||
176 | var zoomFactor = 1; | 176 | var zoomFactor = 1; |
177 | if (this.stage._viewport.style && this.stage._viewport.style.zoom) { | 177 | if (this.stage._viewport && this.stage._viewport.style && this.stage._viewport.style.zoom) { |
178 | zoomFactor = Number(this.stage._viewport.style.zoom); | 178 | zoomFactor = Number(this.stage._viewport.style.zoom); |
179 | } | 179 | } |
180 | 180 | ||
diff --git a/js/stage/stage-view.reel/stage-view.html b/js/stage/stage-view.reel/stage-view.html index ee8fa315..3680e8b5 100755 --- a/js/stage/stage-view.reel/stage-view.html +++ b/js/stage/stage-view.reel/stage-view.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <!-- <copyright> | 2 | <!-- <copyright> |
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> |
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
@@ -12,8 +12,7 @@ | |||
12 | <script type="text/montage-serialization"> | 12 | <script type="text/montage-serialization"> |
13 | { | 13 | { |
14 | "owner": { | 14 | "owner": { |
15 | "module": "js/stage/stage-view.reel", | 15 | "prototype": "js/stage/stage-view.reel", |
16 | "name": "StageView", | ||
17 | "properties": { | 16 | "properties": { |
18 | "element": {"#": "codeViewContainer"} | 17 | "element": {"#": "codeViewContainer"} |
19 | } | 18 | } |
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index f796303c..12a331c3 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html | |||
@@ -1,4 +1,4 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <!-- <copyright> | 2 | <!-- <copyright> |
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> |
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> |
@@ -12,24 +12,21 @@ | |||
12 | <script type="text/montage-serialization"> | 12 | <script type="text/montage-serialization"> |
13 | { | 13 | { |
14 | "stageView" : { | 14 | "stageView" : { |
15 | "module": "js/stage/stage-view.reel", | 15 | "prototype": "js/stage/stage-view.reel", |
16 | "name": "StageView", | ||
17 | "properties": { | 16 | "properties": { |
18 | "element": {"#": "stageView"} | 17 | "element": {"#": "stageView"} |
19 | } | 18 | } |
20 | }, | 19 | }, |
21 | 20 | ||
22 | "StageDeps1": { | 21 | "StageDeps1": { |
23 | "module": "js/stage/stage-deps", | 22 | "prototype": "js/stage/stage-deps", |
24 | "name": "StageDeps", | ||
25 | "properties": { | 23 | "properties": { |
26 | "stage": {"@": "owner"} | 24 | "stage": {"@": "owner"} |
27 | } | 25 | } |
28 | }, | 26 | }, |
29 | 27 | ||
30 | "layout1": { | 28 | "layout1": { |
31 | "module": "js/stage/layout", | 29 | "prototype": "js/stage/layout", |
32 | "name": "Layout", | ||
33 | "properties": { | 30 | "properties": { |
34 | "canvas": {"#": "layoutCanvas"}, | 31 | "canvas": {"#": "layoutCanvas"}, |
35 | "stage": {"@": "owner"} | 32 | "stage": {"@": "owner"} |
@@ -44,8 +41,7 @@ | |||
44 | }, | 41 | }, |
45 | 42 | ||
46 | "textTool": { | 43 | "textTool": { |
47 | "module": "node_modules/labs/rich-text-editor.reel", | 44 | "prototype": "node_modules/labs/rich-text-editor.reel", |
48 | "name": "RichTextEditor", | ||
49 | "properties": { | 45 | "properties": { |
50 | "element" : {"#": "textToolObject"} | 46 | "element" : {"#": "textToolObject"} |
51 | } | 47 | } |
@@ -56,8 +52,7 @@ | |||
56 | }, | 52 | }, |
57 | 53 | ||
58 | "owner": { | 54 | "owner": { |
59 | "module": "js/stage/stage.reel", | 55 | "prototype": "js/stage/stage.reel", |
60 | "name": "Stage", | ||
61 | "properties": { | 56 | "properties": { |
62 | "element": {"#": "stageAndScenesContainer"}, | 57 | "element": {"#": "stageAndScenesContainer"}, |
63 | "_iframeContainer": {"#": "iframeContainer"}, | 58 | "_iframeContainer": {"#": "iframeContainer"}, |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 8382135d..515165bf 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -224,14 +224,6 @@ exports.Stage = Montage.create(Component, { | |||
224 | // Event details will contain the active document prior to opening a new one | 224 | // Event details will contain the active document prior to opening a new one |
225 | handleOpenDocument: { | 225 | handleOpenDocument: { |
226 | value: function(evt) { | 226 | value: function(evt) { |
227 | |||
228 | var prevActiveDocument = evt.detail; | ||
229 | // Hide current document is one is open | ||
230 | if(prevActiveDocument) { | ||
231 | prevActiveDocument.container.style["display"] = "none"; | ||
232 | if(prevActiveDocument.documentType === "htm" || prevActiveDocument.documentType === "html") this.hideCanvas(true); | ||
233 | } | ||
234 | |||
235 | this.hideCanvas(false); | 227 | this.hideCanvas(false); |
236 | 228 | ||
237 | // Recalculate the canvas sizes because of splitter resizing | 229 | // Recalculate the canvas sizes because of splitter resizing |
@@ -239,29 +231,43 @@ exports.Stage = Montage.create(Component, { | |||
239 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11; | 231 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11; |
240 | 232 | ||
241 | this._documentRoot = this.application.ninja.currentDocument.documentRoot; | 233 | this._documentRoot = this.application.ninja.currentDocument.documentRoot; |
242 | this._viewport = this.application.ninja.currentDocument.documentRoot.parentNode; | ||
243 | 234 | ||
244 | this.documentOffsetLeft = this._viewport.offsetLeft; | 235 | // Hardcode this value so that it does not fail for the new stage architecture |
245 | this.documentOffsetTop = this._viewport.offsetTop; | 236 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK |
237 | if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { | ||
238 | this._viewport = this.application.ninja.currentDocument.documentRoot.parentNode; | ||
246 | 239 | ||
247 | // Center the stage | 240 | this.documentOffsetLeft = this._viewport.offsetLeft; |
248 | this.centerStage(); | 241 | this.documentOffsetTop = this._viewport.offsetTop; |
249 | 242 | ||
250 | this._scrollLeft = this._iframeContainer.scrollLeft; | 243 | // Center the stage |
251 | this._scrollTop = this._iframeContainer.scrollTop; | 244 | this.centerStage(); |
252 | this.application.ninja.currentDocument.savedLeftScroll = this._iframeContainer.scrollLeft; | ||
253 | this.application.ninja.currentDocument.savedTopScroll = this._iframeContainer.scrollTop; | ||
254 | 245 | ||
255 | // Hardcode this value so that it does not fail for the new stage architecture | 246 | this._scrollLeft = this._iframeContainer.scrollLeft; |
256 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK | 247 | this._scrollTop = this._iframeContainer.scrollTop; |
257 | this.userContentBorder = 1; //parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border")); | 248 | this.application.ninja.currentDocument.savedLeftScroll = this._iframeContainer.scrollLeft; |
249 | this.application.ninja.currentDocument.savedTopScroll = this._iframeContainer.scrollTop; | ||
258 | 250 | ||
259 | this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | 251 | this.userContentBorder = parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border")); |
260 | this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | 252 | |
253 | this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | ||
254 | this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | ||
255 | |||
256 | this._iframeContainer.addEventListener("scroll", this, false); | ||
257 | |||
258 | this.application.ninja.currentDocument.iframe.style.opacity = 1.0; | ||
259 | } else { | ||
260 | this.userContentBorder = 0; | ||
261 | |||
262 | this._scrollLeft = 0; | ||
263 | this._scrollTop = 0; | ||
264 | this._userContentLeft = 0; | ||
265 | this._userContentTop = 0; | ||
266 | |||
267 | this.application.ninja.currentDocument._window.addEventListener("scroll", this, false); | ||
268 | } | ||
261 | 269 | ||
262 | this.application.ninja.currentDocument.iframe.style.opacity = 1.0; | ||
263 | 270 | ||
264 | this._iframeContainer.addEventListener("scroll", this, false); | ||
265 | 271 | ||
266 | // TODO - We will need to modify this once we support switching between multiple documents | 272 | // TODO - We will need to modify this once we support switching between multiple documents |
267 | this.application.ninja.toolsData.selectedToolInstance._configure(true); | 273 | this.application.ninja.toolsData.selectedToolInstance._configure(true); |
@@ -419,13 +425,10 @@ exports.Stage = Montage.create(Component, { | |||
419 | handleSelectionChange: { | 425 | handleSelectionChange: { |
420 | value: function(event) { | 426 | value: function(event) { |
421 | // TODO - this is a hack for now because some tools depend on selectionDrawn event for some logic | 427 | // TODO - this is a hack for now because some tools depend on selectionDrawn event for some logic |
422 | if(this.drawNow) | 428 | if(this.drawNow) { |
423 | { | ||
424 | this.draw(); | 429 | this.draw(); |
425 | this.drawNow = false; | 430 | this.drawNow = false; |
426 | } | 431 | } else { |
427 | else | ||
428 | { | ||
429 | this.needsDraw = true; | 432 | this.needsDraw = true; |
430 | } | 433 | } |
431 | } | 434 | } |
@@ -448,11 +451,20 @@ exports.Stage = Montage.create(Component, { | |||
448 | */ | 451 | */ |
449 | handleScroll: { | 452 | handleScroll: { |
450 | value: function() { | 453 | value: function() { |
451 | this._scrollLeft = this._iframeContainer.scrollLeft; | 454 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK |
452 | this._scrollTop = this._iframeContainer.scrollTop; | 455 | if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { |
456 | this._scrollLeft = this._iframeContainer.scrollLeft; | ||
457 | this._scrollTop = this._iframeContainer.scrollTop; | ||
458 | |||
459 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | ||
460 | this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | ||
461 | } else { | ||
462 | this._scrollLeft = this.application.ninja.currentDocument.documentRoot.scrollLeft; | ||
463 | this._scrollTop = this.application.ninja.currentDocument.documentRoot.scrollTop; | ||
453 | 464 | ||
454 | this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | 465 | this.userContentLeft = -this._scrollLeft; |
455 | this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | 466 | this.userContentTop = -this._scrollTop; |
467 | } | ||
456 | 468 | ||