From 1c4cec755935d53e5e2ade3bb13e3499ca65f8dc Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 17 Jul 2012 14:32:07 -0700 Subject: Fix: IKNINJA-1935 - Chips handling alpha 0 values Fixed an issue where alpha value was not checked for value and was evaluated in an if statement causing false to trigger, although it had a value. Oversight, this checked allow setting/getting 0 alpha value from chip and fixes issues with the gradient stops not handling 0 alpha. --- js/panels/color/colorpopup-manager.js | 26 +++++++++++++++++++------- 1 file 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, { cvs = this._popupChipBtn.getElementsByTagName('canvas')[0], rgb = this._popupChipBase.colorManager.rgb, hsl = this._popupChipBase.colorManager.hsl, - alpha = this._popupChipBase.colorManager.alpha.value || this._popupChipBase.colorManager.alpha; + alpha; + //Checking for alpha value + if (!isNaN(this._popupChipBase.colorManager.alpha.value)) { + alpha = this._popupChipBase.colorManager.alpha.value; + } else if (!isNaN(this._popupChipBase.colorManager.alpha)){ + alpha = this._popupChipBase.colorManager.alpha; + } // this._popupChipBase._components.hex.value = this._popupChipBase.colorManager.hex; // @@ -312,13 +318,13 @@ exports.ColorPopupManager = Montage.create(Component, { } // if (rgb) { - if (alpha) { + if (!isNaN(alpha)) { this._popupChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); } 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 if (!(e._event.mode && e._event.mode === 'nocolor')) { - if (alpha) { + if (!isNaN(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)'}); @@ -339,7 +345,13 @@ exports.ColorPopupManager = Montage.create(Component, { cvs = this._popupGradientChipBtn.getElementsByTagName('canvas')[0], rgb = this._popupGradientChipBase.colorManager.rgb, hsl = this._popupGradientChipBase.colorManager.hsl, - alpha = this._popupGradientChipBase.colorManager.alpha.value || this._popupGradientChipBase.colorManager.alpha; + alpha; + //Checking for alpha value + if (!isNaN(this._popupGradientChipBase.colorManager.alpha.value)) { + alpha = this._popupGradientChipBase.colorManager.alpha.value; + } else if (!isNaN(this._popupGradientChipBase.colorManager.alpha)){ + alpha = this._popupGradientChipBase.colorManager.alpha; + } // this._popupGradientChipBase._components.hex.value = this._popupGradientChipBase.colorManager.hex; // @@ -367,13 +379,13 @@ exports.ColorPopupManager = Montage.create(Component, { } // if (rgb) { - if (alpha) { + if (!isNaN(alpha)) { this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: alpha, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')'}); } else { this._popupGradientChipBtn.color('rgb', {r: rgb.r, g: rgb.g, b: rgb.b, a: 1, css: 'rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', 1)'}); } } else { - if (alpha) { + if (!isNaN(alpha)) { this._popupGradientChipBtn.color('rgb', {r: 255, g: 255, b: 255, a: alpha, css: 'rgba(255, 255, 255, '+alpha+')'}); } else { 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, { hsv = this.colorManager.rgbToHsv(color.r, color.g, color.b); } // - if (color && color.a && !e._target.base.props.panel) { + if (color && !isNaN(color.a) && !e._target.base.props.panel) { e._target.base.colorManager.alpha = color.a; e._target.base._components.combo.slider.value = color.a*100; } else if (!e._target.base.props.panel){ -- cgit v1.2.3 From 2376d31085de11015fcce455f901e6e925f4f829 Mon Sep 17 00:00:00 2001 From: San Khong Date: Wed, 18 Jul 2012 10:19:26 -0700 Subject: Update Readme.md to add info on Local Cloud settings to support installing multiple builds of Ninja. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 286a99ae..9479a000 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ If you're already familiar with using Git, GitHub, you can clone master branch o - Browse to HKEY_CURRENT_USER/Software/Motorola Mobility/Ninja Local Cloud/Options. - Right click and select New > String value. - Type 'Local Ninja Origin' no quotes. - - Double click on Local Ninja Origin and paste in the Ninja app ID copied in step 6 from the Chrome extensions page in the Value data field. + - Double click on Local Ninja Origin and paste in the Ninja app ID copied in step 6 from the Chrome extensions page in the Value data field. To have multiple builds of Ninja installed but not running simultaneously as this is not supported, multiple app IDs can be added separated by comma and no space. - Close Registry Editor. 8. On Mac: - Launch Finder. - Double click on /Users/\/Library/Preferences/com.MotorolaMobility.Ninja-Local-Cloud.plist. Note: on Lion (10.7), user library folder is hidden by default. To browse to it, in Finder choose Go > Go to Folder and type ~/Library, or select Go menu with Alt (Option) key down to see Library listed in Go menu or make the user library folder permanently visible by running the following command in Terminal: chflags nohidden ~/Library - Click on Add Child Type 'Local Ninja Origin' no quotes. - - For value, paste in the Ninja app ID copied in step 6 from the Chrome extensions page. + - For value, paste in the Ninja app ID copied in step 6 from the Chrome extensions page. To have multiple builds of Ninja installed but not running simultaneously as this is not supported, multiple app IDs can be added separated by comma and no space. - Save (File > Save or Cmd S). - Close Property List Editor. 9. Quit Ninja Local Cloud -- cgit v1.2.3