Commits

Anonymous committed ca81669

Textured slider - killed the cached button rects (thanks Chris Liscio)

  • Participants
  • Parent commits 7a1871e

Comments (0)

Files changed (2)

BWTexturedSlider.h

 @interface BWTexturedSlider : NSSlider
 {
 	int trackHeight, indicatorIndex;
-	NSRect sliderCellRect, minButtonRect, maxButtonRect;
+	NSRect sliderCellRect;
 	NSButton *minButton, *maxButton;
 }
 

BWTexturedSlider.m

 	{
 		indicatorIndex = [decoder decodeIntForKey:@"BWTSIndicatorIndex"];
 		[self setMinButton:[decoder decodeObjectForKey:@"BWTSMinButton"]];
-		[self setMaxButton:[decoder decodeObjectForKey:@"BWTSMaxButton"]];
-		
-		minButtonRect = NSMakeRect(0, 0, imageInset, self.bounds.size.height);
-		maxButtonRect = NSMakeRect(NSMaxX(self.bounds) - imageInset, 0, imageInset, self.bounds.size.height);		
+		[self setMaxButton:[decoder decodeObjectForKey:@"BWTSMaxButton"]];	
 	}
 	return self;
 }
 	
 	NSPoint convertedPoint = [self convertPoint:aPoint fromView:nil];
 	
-	if (NSPointInRect(convertedPoint, minButtonRect))
+	if (NSPointInRect(convertedPoint, minButton.frame))
 		return minButton;
-	else if (NSPointInRect(convertedPoint, maxButtonRect))
+	else if (NSPointInRect(convertedPoint, maxButton.frame))
 		return maxButton;
 	else
 		return [super hitTest:aPoint];