diff options
author | Jose Antonio Marquez | 2012-06-27 10:49:24 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-27 10:49:24 -0700 |
commit | dfa8bfa14de3e60f5fc3797436f39c5b24e40592 (patch) | |
tree | fa24aa335248221bbdd13fb60b9c2463435166fa /js | |
parent | e41615001f80edafb2ee329851dbbb94025f0eed (diff) | |
download | ninja-dfa8bfa14de3e60f5fc3797436f39c5b24e40592.tar.gz |
Adding no color support to popup in chips
Diffstat (limited to 'js')
-rwxr-xr-x | js/panels/color/colorpanelpopup.reel/colorpanelpopup.js | 17 | ||||
-rwxr-xr-x | js/panels/color/colorpopup-manager.js | 7 |
2 files changed, 10 insertions, 14 deletions
diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js index 3eb6eec6..4a868a6d 100755 --- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js +++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js | |||
@@ -32,17 +32,6 @@ exports.ColorPanelPopup = Montage.create(Component, { | |||
32 | set: function(value) {if (value !== this._colorManager) this._colorManager = value;} | 32 | set: function(value) {if (value !== this._colorManager) this._colorManager = value;} |
33 | }, | 33 | }, |
34 | //////////////////////////////////////////////////////////////////// | 34 | //////////////////////////////////////////////////////////////////// |
35 | //Storing color panel | ||
36 | _colorPanel: { | ||
37 | value: false | ||
38 | }, | ||
39 | //////////////////////////////////////////////////////////////////// | ||
40 | //Color panel | ||
41 | colorPanel: { | ||
42 | get: function() {return this._colorPanel;}, | ||
43 | set: function(value) {this._colorPanel = value;} | ||
44 | }, | ||
45 | //////////////////////////////////////////////////////////////////// | ||
46 | // | 35 | // |
47 | _components: { | 36 | _components: { |
48 | value: null | 37 | value: null |
@@ -52,6 +41,10 @@ exports.ColorPanelPopup = Montage.create(Component, { | |||
52 | setNoColor: { | 41 | setNoColor: { |
53 | value: function (code) { | 42 | value: function (code) { |
54 | if (this.colorManager) this.colorManager.applyNoColor(code); | 43 | if (this.colorManager) this.colorManager.applyNoColor(code); |
44 | // | ||
45 | if (!code && !this.props.panel) { | ||
46 | this.dispatchEvent({type: 'change', wasSetByCode: code, mode: 'nocolor', value: null}); | ||
47 | } | ||
55 | } | 48 | } |
56 | }, | 49 | }, |
57 | //////////////////////////////////////////////////////////////////// | 50 | //////////////////////////////////////////////////////////////////// |
@@ -161,7 +154,7 @@ exports.ColorPanelPopup = Montage.create(Component, { | |||
161 | if (!this.props || (this.props && this.props.nocolor)) { | 154 | if (!this.props || (this.props && this.props.nocolor)) { |
162 | // | 155 | // |
163 | this.btnNocolor.addEventListener('click', function () { | 156 | this.btnNocolor.addEventListener('click', function () { |
164 | this.setNoColor(); | 157 | this.setNoColor(false); |
165 | }.bind(this), true); | 158 | }.bind(this), true); |
166 | } else { | 159 | } else { |
167 | this.btnNocolor.style.display = 'none'; | 160 | this.btnNocolor.style.display = 'none'; |
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js index 644cb2fc..91f776bd 100755 --- a/js/panels/color/colorpopup-manager.js +++ b/js/panels/color/colorpopup-manager.js | |||
@@ -291,12 +291,14 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
291 | } else { | 291 | } else { |
292 | this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); | 292 | this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); |
293 | } | 293 | } |
294 | } else { | 294 | } else if (!(e._event.mode && e._event.mode === 'nocolor')) { |
295 | if (alpha) { | 295 | if (alpha) { |
296 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); | 296 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); |
297 | } else { | 297 | } else { |
298 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); | 298 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); |
299 | } | 299 | } |
300 | } else { | ||
301 | this._popupChipBtn.color('nocolor', null); | ||
300 | } | 302 | } |
301 | } | 303 | } |
302 | }, | 304 | }, |
@@ -603,7 +605,6 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
603 | // | 605 | // |
604 | handleChange: { | 606 | handleChange: { |
605 | value: function (e) { | 607 | value: function (e) { |
606 | //console.log(e); | ||
607 | if (this._popupChipBase && this._popupChipBase.opened && (!this._popupGradientChipBase || (this._popupGradientChipBase && !this._popupGradientChipBase.opened))) { | 608 | if (this._popupChipBase && this._popupChipBase.opened && (!this._popupGradientChipBase || (this._popupGradientChipBase && !this._popupGradientChipBase.opened))) { |
608 | if (e._event.hsv) { | 609 | if (e._event.hsv) { |
609 | this._popupChipBase.colorManager.hsv = {h: e._event.hsv.h, s: e._event.hsv.s, v: e._event.hsv.v, type: e._event.type, wasSetByCode: e._event.wasSetByCode}; | 610 | this._popupChipBase.colorManager.hsv = {h: e._event.hsv.h, s: e._event.hsv.s, v: e._event.hsv.v, type: e._event.type, wasSetByCode: e._event.wasSetByCode}; |
@@ -618,6 +619,8 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
618 | this._popupChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false}; | 619 | this._popupChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false}; |
619 | } | 620 | } |
620 | this.colorChipChange(e); | 621 | this.colorChipChange(e); |
622 | } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'nocolor')) { | ||
623 | this.colorChipChange(e); | ||
621 | } | 624 | } |
622 | } | 625 | } |
623 | return; | 626 | return; |