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') 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