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 a12cabc16273ffe04af4bce1f7438dc9326efa89 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Tue, 17 Jul 2012 15:58:41 -0700 Subject: Timeline: Possible fix for new file/new style crash problem. --- js/panels/Timeline/Style.reel/Style.js | 26 +++--- js/panels/Timeline/Style.reel/css/Style.css | 124 +++++++++----------------- js/panels/Timeline/Style.reel/scss/Style.scss | 2 +- 3 files changed, 57 insertions(+), 95 deletions(-) diff --git a/js/panels/Timeline/Style.reel/Style.js b/js/panels/Timeline/Style.reel/Style.js index 930e1281..1d72199a 100644 --- a/js/panels/Timeline/Style.reel/Style.js +++ b/js/panels/Timeline/Style.reel/Style.js @@ -438,12 +438,12 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, { _showView : { value: function() { if (this.whichView === "hintable") { - this.containerHintable.classList.remove("hidden"); - this.containerPropvals.classList.add("hidden"); + this.containerHintable.classList.remove("hideme"); + this.containerPropvals.classList.add("hideme"); this.myHintable.start(); } else { - this.containerHintable.classList.add("hidden"); - this.containerPropvals.classList.remove("hidden"); + this.containerHintable.classList.add("hideme"); + this.containerPropvals.classList.remove("hideme"); this._showTweener(); } } @@ -466,9 +466,9 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, { } if (tweenable.tweener === "hottext" ) { - this.editorInputContainer.classList.add("hidden"); - this.editorColorContainer.classList.add("hidden"); - this.editorHottextContainer.classList.remove("hidden"); + this.editorInputContainer.classList.add("hideme"); + this.editorColorContainer.classList.add("hideme"); + this.editorHottextContainer.classList.remove("hideme"); this.valueEditorHottext.acceptableUnits = [tweenable.units]; this.valueEditorHottext.units = tweenable.units; this.valueEditorHottext.minValue = tweenable.min; @@ -481,9 +481,9 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, { this.valueEditorHottext.addEventListener("changing",this,false); this.valueEditorHottext.needsDraw = true; } else if (tweenable.tweener === "color" ) { - this.editorInputContainer.classList.add("hidden"); - this.editorColorContainer.classList.remove("hidden"); - this.editorHottextContainer.classList.add("hidden"); + this.editorInputContainer.classList.add("hideme"); + this.editorColorContainer.classList.remove("hideme"); + this.editorHottextContainer.classList.add("hideme"); if(tweenable.colorType === "fill"){ this._isFill = true; @@ -508,9 +508,9 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, { } // TODO: set up color chip here. } else if (tweenable.tweener === "input"){ - this.editorInputContainer.classList.remove("hidden"); - this.editorColorContainer.classList.add("hidden"); - this.editorHottextContainer.classList.add("hidden"); + this.editorInputContainer.classList.remove("hideme"); + this.editorColorContainer.classList.add("hideme"); + this.editorHottextContainer.classList.add("hideme"); this.valueEditorInput.value = this.editorValue; this.valueEditorInput.addEventListener("blur",this,false); } else { diff --git a/js/panels/Timeline/Style.reel/css/Style.css b/js/panels/Timeline/Style.reel/css/Style.css index 4819d4f5..c0130988 100644 --- a/js/panels/Timeline/Style.reel/css/Style.css +++ b/js/panels/Timeline/Style.reel/css/Style.css @@ -1,3 +1,4 @@ +@charset "UTF-8"; /* Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. @@ -5,16 +6,11 @@ All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of Motorola Mobility LLC nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. +* Neither the name of Motorola Mobility LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -28,76 +24,42 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* Layer.scss - * Main SCSS file for Layer component, compiled by SASS into the file css/Layer.css. - */ -.hidden { - display: none; } - -.row-editor { - position: relative; - height: 14px; } - -.style-padding { - padding-left: 5px; - padding-top: 3px; - padding-right: 5px; } - -.style-row { - height: 20px; - border-bottom: 1px solid #505050; } - -div.content-style div.editable2 { - height: 14px; - background-color: #242424 !important; - color: #b2b2b2 !important; - border-width: 0px; - font-size: 11px; - overflow: hidden; - -webkit-user-select: text; - white-space: nowrap; - text-overflow: clip; - width: 100%; } - -.content-style.collapsible-content, -.content-style.collapsible-content div, -.content-style.collapsible-content span { - overflow: visible; - text-overflow: visible; } - -div.content-style div.cell-property, -div.content-style div.cell-value { - width: 45%; - float: left; - height: 18px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - line-height: 18px; } - -div.content-style div.cell-property div { - min-width: 90%; - height: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } - -div.content-style input.nj-skinned { - height: 10px; - font-size: 12px; - top: -3px; } - -div.style-row .container-propvals { - overflow: hidden; } - -.content-style .style-row.selected { - background-color: #474747; - color: white; } - -.content-style .style-row.style-selected { - background-color: #b2b2b2; - color: #242424; } - -.toolColorChipCtrl.color-chip-position { - margin-top: 0px; - height: 14px; } +/* Layer.scss Main SCSS file for Layer component, compiled by SASS into the file css/Layer.css. */ +/* line 43, ../scss/Style.scss */ +.hideme { display: none; } + +/* line 46, ../scss/Style.scss */ +.row-editor { position: relative; height: 14px; } + +/* line 50, ../scss/Style.scss */ +.style-padding { padding-left: 5px; padding-top: 3px; padding-right: 5px; } + +/* line 55, ../scss/Style.scss */ +.style-row { height: 20px; border-bottom: 1px solid #505050; } + +/* line 60, ../scss/Style.scss */ +div.content-style div.editable2 { height: 14px; background-color: #242424 !important; color: #b2b2b2 !important; border-width: 0px; font-size: 11px; overflow: hidden; -webkit-user-select: text; white-space: nowrap; text-overflow: clip; width: 100%; } + +/* line 74, ../scss/Style.scss */ +.content-style.collapsible-content, .content-style.collapsible-content div, .content-style.collapsible-content span { overflow: visible; text-overflow: visible; } + +/* line 79, ../scss/Style.scss */ +div.content-style div.cell-property, div.content-style div.cell-value { width: 45%; float: left; height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; } + +/* line 88, ../scss/Style.scss */ +div.content-style div.cell-property div { min-width: 90%; height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + +/* line 96, ../scss/Style.scss */ +div.content-style input.nj-skinned { height: 10px; font-size: 12px; top: -3px; } + +/* line 101, ../scss/Style.scss */ +div.style-row .container-propvals { overflow: hidden; } + +/* line 105, ../scss/Style.scss */ +.content-style .style-row.selected { background-color: #474747; color: white; } + +/* line 109, ../scss/Style.scss */ +.content-style .style-row.style-selected { background-color: #b2b2b2; color: #242424; } + +/* line 114, ../scss/Style.scss */ +.toolColorChipCtrl.color-chip-position { margin-top: 0px; height: 14px; } diff --git a/js/panels/Timeline/Style.reel/scss/Style.scss b/js/panels/Timeline/Style.reel/scss/Style.scss index 2d1947b0..ad527ad5 100644 --- a/js/panels/Timeline/Style.reel/scss/Style.scss +++ b/js/panels/Timeline/Style.reel/scss/Style.scss @@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE. // Import generic mixins and styles @import "../../../../../scss/imports/scss/mixins"; -.hidden { +.hideme { display: none; } .row-editor { -- cgit v1.2.3