mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 06:00:37 +00:00
* NSSliderCell.m: knobRectFlipped: fix draw bugs in slider.app example.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3801 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a136e2ee9c
commit
d7feaa84c0
2 changed files with 27 additions and 21 deletions
|
@ -81,28 +81,30 @@
|
|||
|
||||
- (NSRect)knobRectFlipped:(BOOL)flipped
|
||||
{
|
||||
NSImage* image = [_knobCell image];
|
||||
NSSize size;
|
||||
NSPoint origin;
|
||||
float floatValue;
|
||||
NSImage* image = [_knobCell image];
|
||||
NSSize size;
|
||||
NSPoint origin;
|
||||
float floatValue;
|
||||
|
||||
if (_isVertical && flipped)
|
||||
_floatValue = _maxValue + _minValue - _floatValue;
|
||||
|
||||
floatValue = (_floatValue - _minValue) / (_maxValue - _minValue);
|
||||
|
||||
size = [image size];
|
||||
|
||||
if (_isVertical) {
|
||||
origin.x = 0;
|
||||
origin.y = (_trackRect.size.height - size.height) * floatValue;
|
||||
}
|
||||
else {
|
||||
origin.x = (_trackRect.size.width - size.width) * floatValue;
|
||||
origin.y = 0;
|
||||
}
|
||||
|
||||
return NSMakeRect (origin.x, origin.y, size.width, size.height);
|
||||
if (_isVertical && flipped)
|
||||
_floatValue = _maxValue + _minValue - _floatValue;
|
||||
|
||||
floatValue = (_floatValue - _minValue) / (_maxValue - _minValue);
|
||||
|
||||
size = [image size];
|
||||
|
||||
if (_isVertical)
|
||||
{
|
||||
origin.x = 2;
|
||||
origin.y = ((_trackRect.size.height - size.height) * floatValue) + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
origin.x = ((_trackRect.size.width - size.width) * floatValue) + 2;
|
||||
origin.y = 2;
|
||||
}
|
||||
|
||||
return NSMakeRect (origin.x, origin.y, size.width, size.height);
|
||||
}
|
||||
|
||||
- (void)drawKnob
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue