diff options
author | Valerio Virgillito | 2012-05-18 01:36:05 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-18 01:36:05 -0700 |
commit | 24d1873302b2fffc25d254e15e8aa36f59eedb88 (patch) | |
tree | 29658da7910ff5bd5709ccebd758a9d46ee2ff4f | |
parent | e9dddef38507cafcf5702ce6a512b4005609acef (diff) | |
download | ninja-24d1873302b2fffc25d254e15e8aa36f59eedb88.tar.gz |
fixed a switch documents bug where the layout was getting called before setting the container.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-x | js/controllers/document-controller.js | 4 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 6 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 8 |
3 files changed, 15 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index ea4022b8..f1523d87 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -492,6 +492,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
492 | currentDocument.model.views.design.hide(); | 492 | currentDocument.model.views.design.hide(); |
493 | } | 493 | } |
494 | 494 | ||
495 | this.application.ninja.stage.clearAllCanvas(); | ||
496 | |||
495 | if(didCreate) { | 497 | if(didCreate) { |
496 | newDocument.model.views.design.iframe.style.opacity = 1; | 498 | newDocument.model.views.design.iframe.style.opacity = 1; |
497 | NJevent("onOpenDocument", newDocument); | 499 | NJevent("onOpenDocument", newDocument); |
@@ -499,7 +501,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
499 | this.activeDocument = newDocument; | 501 | this.activeDocument = newDocument; |
500 | newDocument.model.views.design.show(); | 502 | newDocument.model.views.design.show(); |
501 | newDocument.deserializeDocument(); | 503 | newDocument.deserializeDocument(); |
502 | NJevent("switchDocument"); | 504 | NJevent("onSwitchDocument"); |
503 | } | 505 | } |
504 | } | 506 | } |
505 | }, | 507 | }, |
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 067a005f..6d41cd53 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -175,7 +175,7 @@ exports.Ninja = Montage.create(Component, { | |||
175 | this.eventManager.addEventListener("selectTool", this, false); | 175 | this.eventManager.addEventListener("selectTool", this, false); |
176 | this.eventManager.addEventListener("selectSubTool", this, false); | 176 | this.eventManager.addEventListener("selectSubTool", this, false); |
177 | this.eventManager.addEventListener("onOpenDocument", this, false); | 177 | this.eventManager.addEventListener("onOpenDocument", this, false); |
178 | this.eventManager.addEventListener("switchDocument", this, false); | 178 | this.eventManager.addEventListener("onSwitchDocument", this, false); |
179 | 179 | ||
180 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); | 180 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); |
181 | this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); | 181 | this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); |
@@ -291,13 +291,15 @@ exports.Ninja = Montage.create(Component, { | |||
291 | } | 291 | } |
292 | }, | 292 | }, |
293 | 293 | ||
294 | handleSwitchDocument: { | 294 | handleOnSwitchDocument: { |
295 | value: function() { | 295 | value: function() { |
296 | this.currentDocument = this.documentController.activeDocument; | 296 | this.currentDocument = this.documentController.activeDocument; |
297 | 297 | ||
298 | if(this.currentDocument.documentRoot) { | 298 | if(this.currentDocument.documentRoot) { |
299 | this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; | 299 | this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; |
300 | } | 300 | } |
301 | |||
302 | NJevent("switchDocument"); | ||
301 | } | 303 | } |
302 | }, | 304 | }, |
303 | 305 | ||
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index cac99326..8da89fb9 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -593,6 +593,14 @@ exports.Stage = Montage.create(Component, { | |||
593 | } | 593 | } |
594 | }, | 594 | }, |
595 | 595 | ||
596 | clearAllCanvas: { | ||
597 | value: function() { | ||
598 | this._drawingContext.clearRect(0, 0, this._drawingCanvas.width, this._drawingCanvas.height); | ||
599 | this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); | ||
600 | this.layout.clearCanvas(); | ||
601 | } | ||
602 | }, | ||
603 | |||
596 | SelectTool: { | 604 | SelectTool: { |
597 | value: function(cursor) { | 605 | value: function(cursor) { |
598 | this._drawingCanvas.style.cursor = cursor; | 606 | this._drawingCanvas.style.cursor = cursor; |