aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/panels/color/colorpanelpopup.reel/colorpanelpopup.js26
-rwxr-xr-xjs/panels/color/colorpopup-manager.js10
2 files changed, 23 insertions, 13 deletions
diff --git a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
index 4a868a6d..b8261f26 100755
--- a/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
+++ b/js/panels/color/colorpanelpopup.reel/colorpanelpopup.js
@@ -128,7 +128,7 @@ exports.ColorPanelPopup = Montage.create(Component, {
128 this.popupSwitchInputTo(this.palettes); 128 this.popupSwitchInputTo(this.palettes);
129 }.bind(this), true); 129 }.bind(this), true);
130 // 130 //
131 this.drawPalette(this.defaultPalette); 131 this.drawPalette(this.defaultPalette, this.colorManager);
132 } else { 132 } else {
133 this.btnPalette.style.display = 'none'; 133 this.btnPalette.style.display = 'none';
134 } 134 }
@@ -297,7 +297,7 @@ if (this._components.wheel._value) {
297 //////////////////////////////////////////////////////////////////// 297 ////////////////////////////////////////////////////////////////////
298 // 298 //
299 drawPalette: { 299 drawPalette: {
300 value: function (c) { 300 value: function (c, m) {
301 var i, button; 301 var i, button;
302 // 302 //
303 this.palettes.style.display = 'block'; 303 this.palettes.style.display = 'block';
@@ -316,27 +316,31 @@ if (this._components.wheel._value) {
316 color = b._event.srcElement.colorValue; 316 color = b._event.srcElement.colorValue;
317 color.wasSetByCode = false; 317 color.wasSetByCode = false;
318 color.type = 'change'; 318 color.type = 'change';
319 this.colorManager[b._event.srcElement.colorMode] = color; 319 m[b._event.srcElement.colorMode] = color;
320 } else { 320 } else {
321 if (this.colorManager.mode === 'hsl') { 321 if (m.mode === 'hsl') {
322 rgb = this.colorManager.hexToRgb(b._event.srcElement.colorValue); 322 rgb = m.hexToRgb(b._event.srcElement.colorValue);
323 if (rgb) { 323 if (rgb) {
324 color = this.colorManager.rgbToHsl(rgb.r, rgb.g, rgb.b); 324 color = m.rgbToHsl(rgb.r, rgb.g, rgb.b);
325 color.wasSetByCode = false; 325 color.wasSetByCode = false;
326 color.type = 'change'; 326 color.type = 'change';
327 this.colorManager.hsl = color; 327 m.hsl = color;
328 } else { 328 } else {
329 this.colorManager.applyNoColor(false); 329 m.applyNoColor(false);
330 } 330 }
331 } else { 331 } else {
332 color = this.colorManager.hexToRgb(b._event.srcElement.colorValue); 332 color = m.hexToRgb(b._event.srcElement.colorValue);
333 if (color) { 333 if (color) {
334 color.wasSetByCode = false; 334 color.wasSetByCode = false;
335 color.type = 'change'; 335 color.type = 'change';
336 this.colorManager.rgb = color; 336 m.rgb = color;
337 } else { 337 } else {
338 this.colorManager.applyNoColor(false); 338 m.applyNoColor(false);
339 } 339 }
340 //TODO: Remove this is a hack
341 if (!this.props.panel) {
342 this.dispatchEvent({type: 'change', wasSetByCode: false, mode: 'hex', value: b._event.srcElement.colorValue});
343 }
340 } 344 }
341 } 345 }
342 }.bind(this), true); 346 }.bind(this), true);
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js
index 91f776bd..d5cc8ac8 100755
--- a/js/panels/color/colorpopup-manager.js
+++ b/js/panels/color/colorpopup-manager.js
@@ -621,6 +621,8 @@ exports.ColorPopupManager = Montage.create(Component, {
621 this.colorChipChange(e); 621 this.colorChipChange(e);
622 } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'nocolor')) { 622 } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'nocolor')) {
623 this.colorChipChange(e); 623 this.colorChipChange(e);
624 } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'hex')) {
625 this.colorChipChange(e);
624 } 626 }
625 } 627 }
626 return; 628 return;
@@ -637,14 +639,18 @@ exports.ColorPopupManager = Montage.create(Component, {
637 this._popupGradientChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false}; 639 this._popupGradientChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false};
638 } 640 }
639 this.colorGradientChipChange(e); 641 this.colorGradientChipChange(e);
640 } 642 } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'hex')) {
643 this.colorGradientChipChange(e);
644 }
641 } else { 645 } else {
642 if (!isNaN(e._target._xStart) && !e._event.wasSetByCode) { 646 if (!isNaN(e._target._xStart) && !e._event.wasSetByCode) {
643 if (!isNaN(e._target._numValue)) { 647 if (!isNaN(e._target._numValue)) {
644 this._popupGradientChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false}; 648 this._popupGradientChipBase.colorManager.alpha = {value: e._target._numValue/100, type: 'change', wasSetByCode: false};
645 } 649 }
646 this.colorGradientChipChange(e); 650 this.colorGradientChipChange(e);
647 } 651 } else if (!e._event.wasSetByCode && (e._event.mode && e._event.mode === 'hex')) {
652 this.colorGradientChipChange(e);
653 }
648 } 654 }
649 return; 655 return;
650 } 656 }