From dfa8bfa14de3e60f5fc3797436f39c5b24e40592 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 27 Jun 2012 10:49:24 -0700 Subject: Adding no color support to popup in chips --- js/panels/color/colorpanelpopup.reel/colorpanelpopup.js | 17 +++++------------ js/panels/color/colorpopup-manager.js | 7 +++++-- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'js/panels/color') 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, { set: function(value) {if (value !== this._colorManager) this._colorManager = value;} }, //////////////////////////////////////////////////////////////////// - //Storing color panel - _colorPanel: { - value: false - }, - //////////////////////////////////////////////////////////////////// - //Color panel - colorPanel: { - get: function() {return this._colorPanel;}, - set: function(value) {this._colorPanel = value;} - }, - //////////////////////////////////////////////////////////////////// // _components: { value: null @@ -52,6 +41,10 @@ exports.ColorPanelPopup = Montage.create(Component, { setNoColor: { value: function (code) { if (this.colorManager) this.colorManager.applyNoColor(code); + // + if (!code && !this.props.panel) { + this.dispatchEvent({type: 'change', wasSetByCode: code, mode: 'nocolor', value: null}); + } } }, //////////////////////////////////////////////////////////////////// @@ -161,7 +154,7 @@ exports.ColorPanelPopup = Montage.create(Component, { if (!this.props || (this.props && this.props.nocolor)) { // this.btnNocolor.addEventListener('click', function () { - this.setNoColor(); + this.setNoColor(false); }.bind(this), true); } else { 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, { } else { this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); } - } else { + } else if (!(e._event.mode && e._event.mode === 'nocolor')) { if (alpha) { this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); } else { this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); } + } else { + this._popupChipBtn.color('nocolor', null); } } }, @@ -603,7 +605,6 @@ exports.ColorPopupManager = Montage.create(Component, { // handleChange: { value: function (e) { - //console.log(e); if (this._popupChipBase && this._popupChipBase.opened && (!this._popupGradientChipBase || (this._popupGradientChipBase && !this._popupGradientChipBase.opened))) { if (e._event.hsv) { 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, { this._popupChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false}; } this.colorChipChange(e); + } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'nocolor')) { + this.colorChipChange(e); } } return; -- cgit v1.2.3