aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-17 23:58:10 -0700
committerValerio Virgillito2012-07-17 23:58:10 -0700
commitfbfa3ee872f2f8082f54d2d10f1b169cfdf9d1da (patch)
tree9549403934640ac5401969c793235fcfb70eb1af /js
parent4f737b24c19ddc02d20f9783b8b080fc6ef11142 (diff)
parent1c4cec755935d53e5e2ade3bb13e3499ca65f8dc (diff)
downloadninja-fbfa3ee872f2f8082f54d2d10f1b169cfdf9d1da.tar.gz
Merge pull request #399 from joseeight/Color
Fix: IKNINJA-1935 - Chips handling alpha 0 values
Diffstat (limited to 'js')
-rwxr-xr-xjs/panels/color/colorpopup-manager.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js
index 7b18b011..cca9c340 100755
--- a/js/panels/color/colorpopup-manager.js
+++ b/js/panels/color/colorpopup-manager.js
@@ -284,7 +284,13 @@ exports.ColorPopupManager = Montage.create(Component, {
284 cvs = this._popupChipBtn.getElementsByTagName('canvas')[0], 284 cvs = this._popupChipBtn.getElementsByTagName('canvas')[0],
285 rgb = this._popupChipBase.colorManager.rgb, 285 rgb = this._popupChipBase.colorManager.rgb,
286 hsl = this._popupChipBase.colorManager.hsl, 286 hsl = this._popupChipBase.colorManager.hsl,
287 alpha = this._popupChipBase.colorManager.alpha.value || this._popupChipBase.colorManager.alpha; 287 alpha;
288 //Checking for alpha value
289 if (!isNaN(this._popupChipBase.colorManager.alpha.value)) {
290 alpha = this._popupChipBase.colorManager.alpha.value;
291 } else if (!isNaN(this._popupChipBase.colorManager.alpha)){
292 alpha = this._popupChipBase.colorManager.alpha;
293 }
288 // 294 //
289 this._popupChipBase._components.hex.value = this._popupChipBase.colorManager.hex; 295 this._popupChipBase._components.hex.value = this._popupChipBase.colorManager.hex;
290 // 296 //
@@ -312,13 +318,13 @@ exports.ColorPopupManager = Montage.create(Component, {
312 } 318 }
313 // 319 //
314 if (rgb) { 320 if (rgb) {
315 if (alpha) { 321 if (!isNaN(alpha)) {
316 this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); 322 this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'});
317 } else { 323 } else {
318 this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); 324 this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'});
319 } 325 }
320 } else if (!(e._event.mode && e._event.mode === 'nocolor')) { 326 } else if (!(e._event.mode && e._event.mode === 'nocolor')) {
321 if (alpha) { 327 if (!isNaN(alpha)) {
322 this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); 328 this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'});
323 } else { 329 } else {
324 this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); 330 this._popupChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'});
@@ -339,7 +345,13 @@ exports.ColorPopupManager = Montage.create(Component, {
339 cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0], 345 cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0],
340 rgb = this._popupGradientChipBase.colorManager.rgb, 346 rgb = this._popupGradientChipBase.colorManager.rgb,
341 hsl = this._popupGradientChipBase.colorManager.hsl, 347 hsl = this._popupGradientChipBase.colorManager.hsl,
342 alpha = this._popupGradientChipBase.colorManager.alpha.value || this._popupGradientChipBase.colorManager.alpha; 348 alpha;
349 //Checking for alpha value
350 if (!isNaN(this._popupGradientChipBase.colorManager.alpha.value)) {
351 alpha = this._popupGradientChipBase.colorManager.alpha.value;
352 } else if (!isNaN(this._popupGradientChipBase.colorManager.alpha)){
353 alpha = this._popupGradientChipBase.colorManager.alpha;
354 }
343 // 355 //
344 this._popupGradientChipBase._components.hex.value = this._popupGradientChipBase.colorManager.hex; 356 this._popupGradientChipBase._components.hex.value = this._popupGradientChipBase.colorManager.hex;
345 // 357 //
@@ -367,13 +379,13 @@ exports.ColorPopupManager = Montage.create(Component, {
367 } 379 }
368 // 380 //
369 if (rgb) { 381 if (rgb) {
370 if (alpha) { 382 if (!isNaN(alpha)) {
371 this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); 383 this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'});
372 } else { 384 } else {
373 this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); 385 this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'});
374 } 386 }
375 } else { 387 } else {
376 if (alpha) { 388 if (!isNaN(alpha)) {
377 this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); 389 this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'});
378 } else { 390 } else {
379 this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'}); 391 this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: 1, css: 'rgba(255, 255, 255, 1)'});
@@ -615,7 +627,7 @@ exports.ColorPopupManager = Montage.create(Component, {
615 hsv = this.colorManager.rgbToHsv(color.r, color.g, color.b); 627 hsv = this.colorManager.rgbToHsv(color.r, color.g, color.b);
616 } 628 }
617 // 629 //
618 if (color && color.a && !e._target.base.props.panel) { 630 if (color && !isNaN(color.a) && !e._target.base.props.panel) {
619 e._target.base.colorManager.alpha = color.a; 631 e._target.base.colorManager.alpha = color.a;
620 e._target.base._components.combo.slider.value = color.a*100; 632 e._target.base._components.combo.slider.value = color.a*100;
621 } else if (!e._target.base.props.panel){ 633 } else if (!e._target.base.props.panel){