Yes. nearestValidValue looks like a good place to fix it. The question is, 
should it be in Range, Spinner (what a funny name for a base class…) or 
NumericStepper?

I'm thinking Range make the most sense because NaN is not a valid value…

On Apr 7, 2013, at 2:08 PM, Frédéric THOMAS wrote:

> Sorry my bad, you are right, I was looking at another function, I don't use 
> usually FB and it sent me elsewhere.
> 
> well, nearestValidValue looks to be the place.
> 
> -Fred
> 
> -----Message d'origine----- From: Frédéric THOMAS
> Sent: Sunday, April 07, 2013 1:00 PM
> To: [email protected]
> Subject: Re: git commit: Added override to set value to ensure it is not set 
> to NaN
> 
> IMHO, it is more a Spinner thing as the Range doesn’t incr/decr values, so,
> it is valid to set it to a NaN value to say that's a meaningless value but
> the incr/decr have currently no code to manage that situation, that's the
> reason why I thing it could be the place to do it.
> 
> What do you think ?
> 
> -Fred
> 
> -----Message d'origine----- From: Harbs
> Sent: Sunday, April 07, 2013 12:36 PM
> To: [email protected]
> Subject: Re: git commit: Added override to set value to ensure it is not set
> to NaN
> 
> If 0 is out of range, 0 will be converted to minimum automatically.
> 
> But you are probably right. I see no reason to not set it straight to
> minimium.
> 
> It should probably also be fixed in Range set value(). Any reason you can
> think of why it should not be fixed there?
> 
> If you agree, I'll revert NumericStepper and make the change in Range.as…
> 
> Harbs
> 
> On Apr 7, 2013, at 12:43 PM, Frédéric THOMAS wrote:
> 
>> Hi Harbs,
>> 
>> I guess you will have the opportunity to do it again.
>> 
>> What if 0 is out of the Range ?
>> 
>> I guess the right fix is:
>> 
>> if(isNaN(newValue))
>>  newValue = minimum;
>> 
>> -Fred
>> 
>> -----Message d'origine----- From: Harbs
>> Sent: Sunday, April 07, 2013 11:38 AM
>> To: [email protected]
>> Subject: Re: git commit: Added override to set value to ensure it is not set 
>> to NaN
>> 
>> I thought it was automatically prepended because I created a branch for it. 
>> I see that when I deleted the branch, the JIRA number disappeared. Still 
>> learning git… ;-)
>> 
>> FWIW, it was FLEX-33288
>> 
>> Harbs
>> 
>> On Apr 7, 2013, at 11:57 AM, Frédéric THOMAS wrote:
>> 
>>> Take the habit to prepend the issue id to your commit message, it is useful
>>> if someone wants to see the modified code from the source tab of the Jira
>>> issue.
>>> 
>>> -Fred
>>> 
>>> -----Message d'origine----- From: [email protected]
>>> Sent: Sunday, April 07, 2013 9:02 AM
>>> To: [email protected]
>>> Subject: git commit: Added override to set value to ensure it is not set to 
>>> NaN
>>> 
>>> Updated Branches:
>>> refs/heads/develop 9ec4d1780 -> 53ad8aa03
>>> 
>>> 
>>> Added override to set value to ensure it is not set to NaN
>>> 
>>> 
>>> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/53ad8aa0
>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/53ad8aa0
>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/53ad8aa0
>>> 
>>> Branch: refs/heads/develop
>>> Commit: 53ad8aa037d29e1055ec6b532513fa50df730c81
>>> Parents: 9ec4d17
>>> Author: Harbs <[email protected]>
>>> Authored: Sun Apr 7 09:58:20 2013 +0300
>>> Committer: Harbs <[email protected]>
>>> Committed: Sun Apr 7 09:58:20 2013 +0300
>>> 
>>> ----------------------------------------------------------------------
>>> .../spark/src/spark/components/NumericStepper.as   |   11 +++++++++++
>>> 1 files changed, 11 insertions(+), 0 deletions(-)
>>> ----------------------------------------------------------------------
>>> 
>>> 
>>> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/53ad8aa0/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/spark/src/spark/components/NumericStepper.as 
>>> b/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>> index 36a1982..0848245 100644
>>> --- a/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>> +++ b/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>> @@ -740,6 +740,17 @@ public class NumericStepper extends Spinner
>>>  /**
>>>   *  @private
>>>   */
>>> +    override public function set value(newValue:Number):void
>>> +    {
>>> +    if(isNaN(newValue))
>>> +    newValue = 0;
>>> +
>>> +    super.value = newValue;
>>> +    }
>>> +
>>> +    /**
>>> +     *  @private
>>> +     */
>>>  override protected function setValue(newValue:Number):void
>>>  {
>>>      super.setValue(newValue);
>>> 
>> 
> 

Reply via email to