From 0d7d6d4d98437a93f31ededa14ca6eb5382c9e58 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 13 Feb 2012 14:05:10 -0800 Subject: Cleaning up the stage background color chip. Signed-off-by: Valerio Virgillito --- js/components/ui/color-chip.reel/color-chip.js | 16 ---------------- js/controllers/elements/stage-controller.js | 1 - js/panels/properties/content.reel/content.js | 8 -------- js/panels/properties/sections/custom.reel/custom.js | 13 +++++++++---- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js index 4c288084..e51bdd8a 100644 --- a/js/components/ui/color-chip.reel/color-chip.js +++ b/js/components/ui/color-chip.reel/color-chip.js @@ -53,19 +53,6 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; this.application.ninja.colorController.addButton(this.mode, this.chipBtn); - /* - if(this.chip) { - //this.application.ninja.colorController.addButton('fillIcon', this.icon); - this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: 0}; - this.application.ninja.colorController.addButton(this.mode, this.chipBtn); - } else { - //if(this.hasIcon) this.application.ninja.colorController.addButton(this.mode + 'Icon', this.icon); - this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: 20}; - this.application.ninja.colorController.addButton(this.mode, this.chipBtn); - } - */ - - } }, @@ -76,7 +63,6 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { var mode = "rgb", r = 0, g = 0, b = 0, a = 1, css = "rgb(255,0,0)"; if(this.initialColor) { - console.log(this.initialColor); var colorObj = this.application.ninja.colorController.getColorObjFromCss(this.initialColor); mode = colorObj.mode; r = colorObj.value.r; @@ -87,8 +73,6 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { } this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); - //this.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); - this.chipBtn.addEventListener("change", this, false); } } diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index e9fc6bce..af7c4858 100644 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js @@ -94,7 +94,6 @@ exports.StageController = Montage.create(ElementController, { value: function(el, p, value) { switch(p) { case "background": - console.log(value); el.elementModel.stageBackground.style.setProperty(p, value); break; case "overflow": diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index b15f2d71..1ec6d769 100644 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -156,10 +156,6 @@ exports.Content = Montage.create(Component, { var backgroundChip = this.customSections[0].content.controls["background"]; backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background"); - // Get stage color - //var backgroundColor = - //console.log(backgroundColor); - /* var customPI = PiData[this.customPi]; // Get all the custom section for the custom PI @@ -180,10 +176,6 @@ exports.Content = Montage.create(Component, { } }, - foo: { - value: null - }, - handleFirstDraw: { value: function() { this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index 5315defc..a2b9b9fa 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -105,13 +105,14 @@ exports.CustomSection = Montage.create(Component, { } }, + /** + * Color change handler. Hard coding the stage for now since only the stage PI uses this color chip + */ handleColorChange: { value: function(event) { // Change the stage color for now - console.log(this); - console.log(event); - console.log(event._event.color.css); - ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], "background", [event._event.color.css], "Change", "pi", 'foo'); + //console.log(this, event); + ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); /* var propEvent = document.createEvent("CustomEvent"); propEvent.initEvent("propertyChange", true, true); @@ -330,11 +331,15 @@ exports.CustomSection = Montage.create(Component, { createColorChip: { value: function(aField) { var obj = ColorChip.create(); + obj.chip = true; obj.iconType = "fillIcon"; obj.mode = "chip"; obj.offset = 0; + if (aField.id) obj.id = aField.id; + if (aField.prop) obj.prop = aField.prop; + obj.changeDelegate = this.handleColorChange; this.controls[aField.id] = obj; -- cgit v1.2.3