diff options
-rwxr-xr-x | js/panels/color/colorpopup-manager.js | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js index a8e3ba6c..5676095d 100755 --- a/js/panels/color/colorpopup-manager.js +++ b/js/panels/color/colorpopup-manager.js | |||
@@ -258,7 +258,7 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
258 | cvs = this._popupChipBtn.getElementsByTagName('canvas')[0], | 258 | cvs = this._popupChipBtn.getElementsByTagName('canvas')[0], |
259 | rgb = this._popupChipBase.colorManager.rgb, | 259 | rgb = this._popupChipBase.colorManager.rgb, |
260 | hsl = this._popupChipBase.colorManager.hsl, | 260 | hsl = this._popupChipBase.colorManager.hsl, |
261 | alpha = this._popupChipBase.colorManager.alpha.value; | 261 | alpha = this._popupChipBase.colorManager.alpha.value || this._popupChipBase.colorManager.alpha; |
262 | // | 262 | // |
263 | if (cvs) { | 263 | if (cvs) { |
264 | ctx = cvs.getContext('2d'); | 264 | ctx = cvs.getContext('2d'); |
@@ -284,9 +284,17 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
284 | } | 284 | } |
285 | // | 285 | // |
286 | if (rgb) { | 286 | if (rgb) { |
287 | this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); | 287 | if (alpha) { |
288 | this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); | ||
289 | } else { | ||
290 | this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); | ||
291 | } | ||
288 | } else { | 292 | } else { |
289 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); | 293 | if (alpha) { |
294 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); | ||
295 | } else { | ||
296 | this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); | ||
297 | } | ||
290 | } | 298 | } |
291 | } | 299 | } |
292 | }, | 300 | }, |
@@ -301,7 +309,7 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
301 | cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0], | 309 | cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0], |
302 | rgb = this._popupGradientChipBase.colorManager.rgb, | 310 | rgb = this._popupGradientChipBase.colorManager.rgb, |
303 | hsl = this._popupGradientChipBase.colorManager.hsl, | 311 | hsl = this._popupGradientChipBase.colorManager.hsl, |
304 | alpha = this._popupGradientChipBase.colorManager.alpha.value; | 312 | alpha = this._popupGradientChipBase.colorManager.alpha.value || this._popupGradientChipBase.colorManager.alpha; |
305 | // | 313 | // |
306 | if (cvs) { | 314 | if (cvs) { |
307 | ctx = cvs.getContext('2d'); | 315 | ctx = cvs.getContext('2d'); |
@@ -327,9 +335,17 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
327 | } | 335 | } |
328 | // | 336 | // |
329 | if (rgb) { | 337 | if (rgb) { |
330 | this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); | 338 | if (alpha) { |
339 | this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); | ||
340 | } else { | ||
341 | this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); | ||
342 | } | ||
331 | } else { | 343 | } else { |
332 | this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); | 344 | if (alpha) { |
345 | this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); | ||
346 | } else { | ||
347 | this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); | ||
348 | } | ||
333 | } | 349 | } |
334 | } | 350 | } |
335 | }, | 351 | }, |
@@ -591,9 +607,16 @@ exports.ColorPopupManager = Montage.create(Component, { | |||
591 | this._popupGradientChipBase.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}; | 607 | this._popupGradientChipBase.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}; |
592 | this.colorGradientChipChange(e); | 608 | this.colorGradientChipChange(e); |
593 | } else if (!this._popupBase || (this._popupBase && !this._popupBase.opened)){ | 609 | } else if (!this._popupBase || (this._popupBase && !this._popupBase.opened)){ |
594 | // | 610 | if (e._event.gradient && !e._event.wasSetByCode) { |
595 | this._popupChipBtn.color('gradient', e._event.gradient); | 611 | this._popupChipBtn.color('gradient', e._event.gradient); |
596 | } | 612 | } else if (!isNaN(e._target._xStart) && !e._event.wasSetByCode) { |
613 | this.colorGradientChipChange(e); | ||
614 | } | ||
615 | } else { | ||
616 | if (!isNaN(e._target._xStart) && !e._event.wasSetByCode) { | ||
617 | this.colorGradientChipChange(e); | ||
618 | } | ||
619 | } | ||
597 | return; | 620 | return; |
598 | } | 621 | } |
599 | // | 622 | // |