From 5ab7efb9949e486395659c383064a08821febdae Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 15:15:27 -0800 Subject: persist selections while switching documents Signed-off-by: Ananya Sen --- js/panels/properties/content.reel/content.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..9b9b7108 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -55,6 +55,7 @@ exports.Content = Montage.create(Component, { } this.eventManager.addEventListener("openDocument", this, false); + this.eventManager.addEventListener("switchDocument", this, false); } }, @@ -74,6 +75,15 @@ exports.Content = Montage.create(Component, { } }, + handleSwitchDocument: { + value: function(){ + // For now always assume that the stage is selected by default + if(this.application.ninja.selectedElements.length === 0) { + this.displayStageProperties(); + } + } + }, + /** * Blur and Key up to handle change in the Element ID field. */ -- cgit v1.2.3 From 557c4d3100ccde51b925b71f0650b2c783a4a042 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 28 Feb 2012 16:02:15 -0800 Subject: minor fix for handling selections on switch document Signed-off-by: Ananya Sen --- js/panels/properties/content.reel/content.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 9b9b7108..cc9ec96a 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -80,6 +80,12 @@ exports.Content = Montage.create(Component, { // For now always assume that the stage is selected by default if(this.application.ninja.selectedElements.length === 0) { this.displayStageProperties(); + }else { + if(this.application.ninja.selectedElements.length === 1) { + this.displayElementProperties(this.application.ninja.selectedElements[0]._element); + } else { + this.displayGroupProperties(this.application.ninja.selectedElements); + } } } }, -- cgit v1.2.3 From 209e0781e926212bbaaad9e8ca4b61a0c389b30f Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 28 Feb 2012 17:19:42 -0800 Subject: We need to remove color buttons from the color model when updating the PI for selection change. Signed-off-by: Nivesh Rajbhandari --- js/panels/properties/content.reel/content.js | 22 ++++++++++++++++++++++ .../color-select.reel/color-select.html | 4 +++- .../custom-rows/color-select.reel/color-select.js | 21 +++++++++++++++++++++ .../properties/sections/custom.reel/custom.js | 5 +++++ 4 files changed, 51 insertions(+), 1 deletion(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 8fa33a75..58c37db4 100755 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -156,6 +156,17 @@ exports.Content = Montage.create(Component, { this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); if(this.customPi !== stage.elementModel.pi) { + // We need to unregister color chips from the previous selection from the Color Model + var len = this.customSections.length; + for(var n = 0, controls; n < len; n++) { + controls = this.customSections[n].content.controls; + if(controls["colorSelect"]) { + controls["colorSelect"].destroy(); + } else if(controls["stageBackground"]) { + controls["stageBackground"].destroy(); + } + } + this.customPi = stage.elementModel.pi; this.displayCustomProperties(stage, stage.elementModel.pi); } @@ -221,6 +232,17 @@ exports.Content = Montage.create(Component, { // Custom Section if(this.customPi !== el.elementModel.pi) { + // We need to unregister color chips from the previous selection from the Color Model + var len = this.customSections.length; + for(var n = 0, controls; n < len; n++) { + controls = this.customSections[n].content.controls; + if(controls["colorSelect"]) { + controls["colorSelect"].destroy(); + } else if(controls["stageBackground"]) { + controls["stageBackground"].destroy(); + } + } + this.customPi = el.elementModel.pi; this.displayCustomProperties(el, el.elementModel.pi); } diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html index 9c2588b9..96cc4de7 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html @@ -14,7 +14,9 @@ "properties" : { "element" : {"#": "section"}, "Stroke" : {"#": "Stroke"}, - "Fill" : {"#": "Fill"} + "Fill" : {"#": "Fill"}, + "strokeChip" : {"@": "colorChip"}, + "fillChip" : {"@": "colorChip2"} } }, diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js index 60f8efef..3e81ff67 100755 --- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js +++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js @@ -17,6 +17,14 @@ exports.ColorSelect = Montage.create(Component, { value: null }, + strokeChip: { + value: null + }, + + fillChip: { + value: null + }, + handleChange: { value: function(e) { @@ -57,6 +65,19 @@ exports.ColorSelect = Montage.create(Component, { // } } + }, + + destroy: { + value: function() { + if(this.strokeChip) + { + this.strokeChip.destroy(); + } + if(this.fillChip) + { + this.fillChip.destroy(); + } + } } }); \ No newline at end of file diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index a2b9b9fa..a537d323 100755 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -59,6 +59,8 @@ exports.CustomSection = Montage.create(Component, { if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["colorSelect"] = tmpRow; } else { @@ -344,6 +346,9 @@ exports.CustomSection = Montage.create(Component, { this.controls[aField.id] = obj; + // TODO - Hack for now to reference the color select object to unregister color chips + this.controls["stageBackground"] = obj; + return obj; } } -- cgit v1.2.3