diff options
author | Valerio Virgillito | 2012-02-13 14:05:10 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-13 14:05:10 -0800 |
commit | 0d7d6d4d98437a93f31ededa14ca6eb5382c9e58 (patch) | |
tree | 95711517d51e2b100728df267f42390156685c52 /js | |
parent | dcd147265ad0339448ea4466253b03b2899e0cea (diff) | |
download | ninja-0d7d6d4d98437a93f31ededa14ca6eb5382c9e58.tar.gz |
Cleaning up the stage background color chip.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/components/ui/color-chip.reel/color-chip.js | 16 | ||||
-rw-r--r-- | js/controllers/elements/stage-controller.js | 1 | ||||
-rw-r--r-- | js/panels/properties/content.reel/content.js | 8 | ||||
-rw-r--r-- | 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, { | |||
53 | this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; | 53 | this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: this.offset}; |
54 | this.application.ninja.colorController.addButton(this.mode, this.chipBtn); | 54 | this.application.ninja.colorController.addButton(this.mode, this.chipBtn); |
55 | 55 | ||
56 | /* | ||
57 | if(this.chip) { | ||
58 | //this.application.ninja.colorController.addButton('fillIcon', this.icon); | ||
59 | this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: 0}; | ||
60 | this.application.ninja.colorController.addButton(this.mode, this.chipBtn); | ||
61 | } else { | ||
62 | //if(this.hasIcon) this.application.ninja.colorController.addButton(this.mode + 'Icon', this.icon); | ||
63 | this.chipBtn.props = {side: 'right', align: 'top', wheel: true, palette: true, gradient: true, image: true, offset: 20}; | ||
64 | this.application.ninja.colorController.addButton(this.mode, this.chipBtn); | ||
65 | } | ||
66 | */ | ||
67 | |||
68 | |||
69 | } | 56 | } |
70 | }, | 57 | }, |
71 | 58 | ||
@@ -76,7 +63,6 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { | |||
76 | var mode = "rgb", r = 0, g = 0, b = 0, a = 1, css = "rgb(255,0,0)"; | 63 | var mode = "rgb", r = 0, g = 0, b = 0, a = 1, css = "rgb(255,0,0)"; |
77 | 64 | ||
78 | if(this.initialColor) { | 65 | if(this.initialColor) { |
79 | console.log(this.initialColor); | ||
80 | var colorObj = this.application.ninja.colorController.getColorObjFromCss(this.initialColor); | 66 | var colorObj = this.application.ninja.colorController.getColorObjFromCss(this.initialColor); |
81 | mode = colorObj.mode; | 67 | mode = colorObj.mode; |
82 | r = colorObj.value.r; | 68 | r = colorObj.value.r; |
@@ -87,8 +73,6 @@ var ColorChip = exports.ColorChip = Montage.create(Component, { | |||
87 | } | 73 | } |
88 | 74 | ||
89 | this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); | 75 | this.chipBtn.color(mode, {wasSetByCode: true, type: 'change', color: {r: r, g: g, b: b}, css: css}); |
90 | //this.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); | ||
91 | |||
92 | this.chipBtn.addEventListener("change", this, false); | 76 | this.chipBtn.addEventListener("change", this, false); |
93 | } | 77 | } |
94 | } | 78 | } |
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, { | |||
94 | value: function(el, p, value) { | 94 | value: function(el, p, value) { |
95 | switch(p) { | 95 | switch(p) { |
96 | case "background": | 96 | case "background": |
97 | console.log(value); | ||
98 | el.elementModel.stageBackground.style.setProperty(p, value); | 97 | el.elementModel.stageBackground.style.setProperty(p, value); |
99 | break; | 98 | break; |
100 | case "overflow": | 99 | 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, { | |||
156 | var backgroundChip = this.customSections[0].content.controls["background"]; | 156 | var backgroundChip = this.customSections[0].content.controls["background"]; |
157 | backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background"); | 157 | backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background"); |
158 | 158 | ||
159 | // Get stage color | ||
160 | //var backgroundColor = | ||
161 | //console.log(backgroundColor); | ||
162 | |||
163 | /* | 159 | /* |
164 | var customPI = PiData[this.customPi]; | 160 | var customPI = PiData[this.customPi]; |
165 | // Get all the custom section for the custom PI | 161 | // Get all the custom section for the custom PI |
@@ -180,10 +176,6 @@ exports.Content = Montage.create(Component, { | |||
180 | } | 176 | } |
181 | }, | 177 | }, |
182 | 178 | ||
183 | foo: { | ||
184 | value: null | ||
185 | }, | ||
186 | |||
187 | handleFirstDraw: { | 179 | handleFirstDraw: { |
188 | value: function() { | 180 | value: function() { |
189 | this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); | 181 | 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, { | |||
105 | } | 105 | } |
106 | }, | 106 | }, |
107 | 107 | ||
108 | /** | ||
109 | * Color change handler. Hard coding the stage for now since only the stage PI uses this color chip | ||
110 | */ | ||
108 | handleColorChange: { | 111 | handleColorChange: { |
109 | value: function(event) { | 112 | value: function(event) { |
110 | // Change the stage color for now | 113 | // Change the stage color for now |
111 | console.log(this); | 114 | //console.log(this, event); |
112 | console.log(event); | 115 | ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); |
113 | console.log(event._event.color.css); | ||
114 | ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], "background", [event._event.color.css], "Change", "pi", 'foo'); | ||
115 | /* | 116 | /* |
116 | var propEvent = document.createEvent("CustomEvent"); | 117 | var propEvent = document.createEvent("CustomEvent"); |
117 | propEvent.initEvent("propertyChange", true, true); | 118 | propEvent.initEvent("propertyChange", true, true); |
@@ -330,11 +331,15 @@ exports.CustomSection = Montage.create(Component, { | |||
330 | createColorChip: { | 331 | createColorChip: { |
331 | value: function(aField) { | 332 | value: function(aField) { |
332 | var obj = ColorChip.create(); | 333 | var obj = ColorChip.create(); |
334 | |||
333 | obj.chip = true; | 335 | obj.chip = true; |
334 | obj.iconType = "fillIcon"; | 336 | obj.iconType = "fillIcon"; |
335 | obj.mode = "chip"; | 337 | obj.mode = "chip"; |
336 | obj.offset = 0; | 338 | obj.offset = 0; |
337 | 339 | ||
340 | if (aField.id) obj.id = aField.id; | ||
341 | if (aField.prop) obj.prop = aField.prop; | ||
342 | |||
338 | obj.changeDelegate = this.handleColorChange; | 343 | obj.changeDelegate = this.handleColorChange; |
339 | 344 | ||
340 | this.controls[aField.id] = obj; | 345 | this.controls[aField.id] = obj; |