_strokeColor = [NSColor colorWithCalibratedRed:0.749 green:0.761 blue:0.788 alpha:1.0];
_disabledStrokeColor = [NSColor colorWithCalibratedRed:0.749 green:0.761 blue:0.788 alpha:0.2];
-
// Custom knob gradients
_knobGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.251 green:0.251 blue:0.255 alpha:1.0]
endingColor:[NSColor colorWithDeviceRed:0.118 green:0.118 blue:0.118 alpha:1.0]];
// Copy rect
NSRect activeRect = fullRect;
- if (self.isVertical) {
- // Calculate active rect (bottom part of slider)
- if (flipped) {
- activeRect.origin.y = (1 - knobPosition) * activeRect.size.height;
- activeRect.size.height -= activeRect.origin.y - 1;
+ // Do not draw disabled part for sliders with tickmarks
+ if (self.numberOfTickMarks == 0) {
+ if (self.isVertical) {
+ // Calculate active rect (bottom part of slider)
+ if (flipped) {
+ activeRect.origin.y = (1 - knobPosition) * activeRect.size.height;
+ activeRect.size.height -= activeRect.origin.y - 1;
+ } else {
+ activeRect.size.height -= (1 - knobPosition) * activeRect.size.height - 1;
+ }
} else {
- activeRect.size.height -= (1 - knobPosition) * activeRect.size.height - 1;
+ // Calculate active rect (left part of slider)
+ activeRect.size.width = knobPosition * (self.controlView.frame.size.width - 1.0);
}
- } else {
- // Calculate active rect (left part of slider)
- activeRect.size.width = knobPosition * (self.controlView.frame.size.width - 1.0);
- }
- // Draw inactive bar
- [_disabledSliderColor setFill];
- path = [NSBezierPath bezierPathWithRoundedRect:fullRect xRadius:2.0 yRadius:2.0];
- [path fill];
+ // Draw inactive bar
+ [_disabledSliderColor setFill];
+ path = [NSBezierPath bezierPathWithRoundedRect:fullRect xRadius:2.0 yRadius:2.0];
+ [path fill];
+ }
// Draw active bar
[_sliderColor setFill];