From 7a94696e19b14e15261df516e2ba75e693b1313d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 00:21:56 -0700 Subject: enabling basic document switching Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 9f0456ae..ba87e2d5 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -161,9 +161,10 @@ exports.Ninja = Montage.create(Component, { window.addEventListener("resize", this, false); - this.eventManager.addEventListener( "selectTool", this, false); - this.eventManager.addEventListener( "selectSubTool", this, false); - this.eventManager.addEventListener( "onOpenDocument", this, false); + this.eventManager.addEventListener("selectTool", this, false); + this.eventManager.addEventListener("selectSubTool", this, false); + this.eventManager.addEventListener("onOpenDocument", this, false); + this.eventManager.addEventListener("switchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); @@ -279,6 +280,16 @@ exports.Ninja = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function() { + this.currentDocument = this.documentController.activeDocument; + + if(this.currentDocument.documentRoot) { + this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; + } + } + }, + executeLivePreview: { value: function() { var background, overflow, transitionStopRule; -- cgit v1.2.3 From 084bb924bc3c3a6ad1e2e21099399bba4d473fed Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 00:41:31 -0700 Subject: fixing some snapping bugs Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index ba87e2d5..067a005f 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -134,10 +134,21 @@ exports.Ninja = Montage.create(Component, { value: [] }, - currentSelectedContainer: { + _currentSelectedContainer: { value: null }, + currentSelectedContainer: { + get: function() { + return this._currentSelectedContainer; + }, + set: function(value) { + if(value !== this._currentSelectedContainer) { + this._currentSelectedContainer = value; + } + } + }, + templateDidLoad: { value: function() { this.ninjaVersion = window.ninjaVersion.ninja.version; @@ -285,7 +296,7 @@ exports.Ninja = Montage.create(Component, { this.currentDocument = this.documentController.activeDocument; if(this.currentDocument.documentRoot) { - this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; + this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; } } }, -- cgit v1.2.3 From 24d1873302b2fffc25d254e15e8aa36f59eedb88 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 01:36:05 -0700 Subject: fixed a switch documents bug where the layout was getting called before setting the container. Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/ninja.reel/ninja.js') 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, { this.eventManager.addEventListener("selectTool", this, false); this.eventManager.addEventListener("selectSubTool", this, false); this.eventManager.addEventListener("onOpenDocument", this, false); - this.eventManager.addEventListener("switchDocument", this, false); + this.eventManager.addEventListener("onSwitchDocument", this, false); this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); this.addPropertyChangeListener("appModel.chromePreview", this.executeChromePreview, false); @@ -291,13 +291,15 @@ exports.Ninja = Montage.create(Component, { } }, - handleSwitchDocument: { + handleOnSwitchDocument: { value: function() { this.currentDocument = this.documentController.activeDocument; if(this.currentDocument.documentRoot) { this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; } + + NJevent("switchDocument"); } }, -- cgit v1.2.3 From fdfba499f0b84360b96096fa866a981e96e8756c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 16:35:56 -0700 Subject: fixing the color chip for the document root Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 6d41cd53..80d1b406 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -280,7 +280,7 @@ exports.Ninja = Montage.create(Component, { this.currentDocument = event.detail; if(this.currentDocument.documentRoot) { - this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; + this.currentSelectedContainer = this.currentDocument.documentRoot; } else { alert("The current document has not loaded yet"); return; -- cgit v1.2.3 From 2b207ef8b2594927f8cd6cd63a8483d205cb86c4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 22 May 2012 15:41:51 -0700 Subject: fixing the selection in multiple documents and some code cleanup Signed-off-by: Valerio Virgillito --- js/ninja.reel/ninja.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 80d1b406..9f1d1b3b 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -296,7 +296,7 @@ exports.Ninja = Montage.create(Component, { this.currentDocument = this.documentController.activeDocument; if(this.currentDocument.documentRoot) { - this._currentSelectedContainer = this.selectionController._currentSelectedContainer = this.currentDocument.documentRoot; + this._currentSelectedContainer = this.selectionController._selectionContainer = this.currentDocument.documentRoot; } NJevent("switchDocument"); -- cgit v1.2.3