From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 40 ++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'js/panels/properties.reel/properties.js') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 84b0d589..e99f58e9 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -13,6 +13,32 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; exports.Properties = Montage.create(Component, { + _currentDocument: { + value : null, + enumerable : false + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + + if(this._currentDocument.currentView === "design") { + // Save a reference of the pi inside the document view to be able to clear + this._currentDocument.model.views.design.propertiesPanel = this; + + // Display the default document root PI + this.displayElementProperties(this._currentDocument.model.documentRoot); + } + } + }, + elementName: { value: null }, @@ -46,7 +72,7 @@ exports.Properties = Montage.create(Component, { prepareForDraw: { value : function() { - this.eventManager.addEventListener("openDocument", this, false); + this.eventManager.addEventListener("elementChange", this, false); this.eventManager.addEventListener("selectionChange", this, false); this.eventManager.addEventListener("closeDocument", this, false); @@ -65,18 +91,6 @@ exports.Properties = Montage.create(Component, { } }, - handleOpenDocument: { - value: function() { - this.eventManager.addEventListener( "elementChange", this, false); - - // Save a reference of the pi inside the document view to be able to clear - this.application.ninja.currentDocument.model.views.design.propertiesPanel = this; - - // Display the default document root PI - this.displayElementProperties(this.application.ninja.currentDocument.model.documentRoot); - } - }, - handleCloseDocument: { value: function(){ this.clear(); -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'js/panels/properties.reel/properties.js') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index e99f58e9..4b663220 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -29,7 +29,9 @@ exports.Properties = Montage.create(Component, { this._currentDocument = value; - if(this._currentDocument.currentView === "design") { + if(!value) { + this.clear(); + } else if(this._currentDocument.currentView === "design") { // Save a reference of the pi inside the document view to be able to clear this._currentDocument.model.views.design.propertiesPanel = this; @@ -74,7 +76,6 @@ exports.Properties = Montage.create(Component, { value : function() { this.eventManager.addEventListener("elementChange", this, false); this.eventManager.addEventListener("selectionChange", this, false); - this.eventManager.addEventListener("closeDocument", this, false); // This will be a toggle option if(this.application.ninja.appData.PILiveUpdate) { @@ -91,12 +92,6 @@ exports.Properties = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(){ - this.clear(); - } - }, - /** * Blur and Key up to handle change in the Element ID field. */ -- cgit v1.2.3 From 501221d0bbf776ce71bc7ae0f482c931f6651659 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 14:51:25 -0700 Subject: fixing the timeline current document bindings Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/panels/properties.reel/properties.js') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 4b663220..d05fb058 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -14,8 +14,7 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; exports.Properties = Montage.create(Component, { _currentDocument: { - value : null, - enumerable : false + value : null }, currentDocument : { -- cgit v1.2.3 From e1fe603a7c002073f8ac13623f8cc8dc43efb59d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 10:27:46 -0700 Subject: fixing selection when switching documents Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'js/panels/properties.reel/properties.js') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index d05fb058..934a3851 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -28,15 +28,17 @@ exports.Properties = Montage.create(Component, { this._currentDocument = value; - if(!value) { +// if(!value) { this.clear(); - } else if(this._currentDocument.currentView === "design") { - // Save a reference of the pi inside the document view to be able to clear - this._currentDocument.model.views.design.propertiesPanel = this; +// } + /* + else if(this._currentDocument.currentView === "design") { // Display the default document root PI - this.displayElementProperties(this._currentDocument.model.documentRoot); + //this.displayElementProperties(this._currentDocument.model.documentRoot); +// this.displaySelection(this._currentDocument.model.selection); } + */ } }, @@ -181,6 +183,20 @@ exports.Properties = Montage.create(Component, { } }, + displaySelection: { + value: function(selection) { + if(selection.length === 0) { + this.displayElementProperties(this._currentDocument.model.documentRoot); + } else { + if(selection.length === 1) { + this.displayElementProperties(this.application.ninja.selectedElements[0]); + } else { + this.displayGroupProperties(this.application.ninja.selectedElements); + } + } + } + }, + clear: { value: function() { this.elementName.value = ""; -- cgit v1.2.3