Circular sliders never return the maximum value, tested on Apple

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33432 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rmottola 2011-07-02 22:01:23 +00:00
parent fec1e610f9
commit ea48f0b7f9
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2011-07-03 Riccardo Mottola <rm@gnu.org>
* Source/NSSliderCell.m:
Circular sliders never return the maximum value, tested on Apple.
2011-07-02 15:33-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSTableView.m: Modifications to initWithCoder: and

View file

@ -670,7 +670,7 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
if (_numberOfTickMarks == 0)
return aValue;
effectiveTicks = _numberOfTickMarks;
if (_type == NSCircularSlider)
effectiveTicks++;
@ -691,6 +691,10 @@ float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
f = ((aValue - _minValue) * (effectiveTicks - 1)) / d;
f = ((rint(f) * d) / (effectiveTicks - 1)) + _minValue;
/* never return the maximum value, tested on Apple */
if (_type == NSCircularSlider && (f >= _maxValue))
f = _minValue;
return f;
}