Index: src/kits/interface/ColorControl.cpp
===================================================================
--- src/kits/interface/ColorControl.cpp	(revision 23303)
+++ src/kits/interface/ColorControl.cpp	(working copy)
@@ -23,8 +23,10 @@
 
 static const uint32 kMsgColorEntered = 'ccol';
 static const uint32 kMinCellSize = 6;
+static const float kSelectorPenSize = 2.0f;
+static const float kSelectorSize = 4.0f;
+static const float kSelectorHSpacing = 2.0f;
 
-
 BColorControl::BColorControl(BPoint leftTop, color_control_layout layout,
 	float cellSize, const char *name, BMessage *message,
 	bool bufferedDrawing)
@@ -222,42 +224,45 @@
 	c2.blue = (value & 0x0000FF00) >> 8;
 	char string[4];
 
-	// values for calculating the selector rectangles for invalidation
-	// analogous to selector drawing in _DrawColorArea
-	float rampXGradient = (ceil(fColumns * fCellSize) - 4 - 7)  / 255;
-	float rampSize = (Bounds().bottom - 2) / 4.0;
-	float x, y;
+	float invalidateRadius = kSelectorSize/2 + kSelectorPenSize;
+	BPoint p;
 
 	if (c1.red != c2.red) {
 		sprintf(string, "%d", c2.red);
 		fRedText->SetText(string);
 		
-		y = rampSize * 1.5;
-		x = 2 + c1.red * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
-		x = 2 + c2.red * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
+		p = _SelectorPosition(fRampRects[1], c1.red);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));	
+			 
+		p = _SelectorPosition(fRampRects[1], c2.red);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));	
 	}
 
 	if (c1.green != c2.green) {
 		sprintf(string, "%d", c2.green);
 		fGreenText->SetText(string);
 
-		y = rampSize * 2.5;		
-		x = 2 + c1.green * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
-		x = 2 + c2.green * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
+		p = _SelectorPosition(fRampRects[2], c1.green);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));
+			 	
+		p = _SelectorPosition(fRampRects[2], c2.green);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));		
 	}
 	if (c1.blue != c2.blue) {
 		sprintf(string, "%d", c2.blue);
 		fBlueText->SetText(string);
 		
-		y = rampSize * 3.5;
-		x = 2 + c1.blue * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
-		x = 2 + c2.blue * rampXGradient;
-		Invalidate(BRect(x - 2, y - 2, x + 6, y + 6));
+		p = _SelectorPosition(fRampRects[3], c1.blue);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));
+			 	
+		p = _SelectorPosition(fRampRects[3], c2.blue);
+		Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius,
+			 p.x + invalidateRadius, p.y + invalidateRadius));				
 	}
 
 	BControl::SetValueNoUpdate(value);
@@ -397,40 +402,38 @@
 	float rampSize = rampRect.Height() / 4.0;
 
 	rampRect.bottom = rampRect.top + rampSize;
-
+	fRampRects[0] = rampRect;
 	_ColorRamp(rampRect, target, white, 0, false);
 
 	rampRect.OffsetBy(0, rampSize);
+	fRampRects[1] = rampRect;
 	_ColorRamp(rampRect, target, red, 0, false);
 
-	rampRect.OffsetBy(0,rampSize);
+	rampRect.OffsetBy(0, rampSize);
+	fRampRects[2] = rampRect;
 	_ColorRamp(rampRect, target, green, 0, false);
 
 	rampRect.OffsetBy(0, rampSize);
+	fRampRects[3] = rampRect;
 	_ColorRamp(rampRect, target, blue, 0, false);
 
 	// Selectors
 	rgb_color color = ValueAsColor();
-	float x, y = rampSize * 1.5;
-
+	
 	target->SetDrawingMode(B_OP_OVER);
-	target->SetPenSize(2.0f);
-
-	x = rect.left + color.red * (rect.Width() - 7) / 255;
+	target->SetPenSize(kSelectorPenSize);
+	
 	target->SetHighColor(255, 255, 255);
-	target->StrokeEllipse(BRect(x, y, x + 4.0f, y + 4.0f));
+	target->StrokeEllipse(_SelectorPosition(fRampRects[1], color.red),
+		 kSelectorSize / 2, kSelectorSize / 2);
 
-	y += rampSize;
-
-	x = rect.left + color.green * (rect.Width() - 7) / 255;
 	target->SetHighColor(255, 255, 255);
-	target->StrokeEllipse(BRect(x, y, x + 4.0f, y + 4.0f));
+	target->StrokeEllipse(_SelectorPosition(fRampRects[2], color.green),
+		 kSelectorSize / 2, kSelectorSize / 2);
 
-	y += rampSize;
-
-	x = rect.left + color.blue * (rect.Width() - 7) / 255;
 	target->SetHighColor(255, 255, 255);
-	target->StrokeEllipse(BRect(x, y, x + 4.0f, y + 4.0f));
+	target->StrokeEllipse(_SelectorPosition(fRampRects[3], color.blue),
+		 kSelectorSize / 2, kSelectorSize / 2);
 
 	target->SetPenSize(1.0f);
 	target->SetDrawingMode(B_OP_COPY);
@@ -462,6 +465,17 @@
 }
 
 
+BPoint
+BColorControl::_SelectorPosition(const BRect& rampRect, uint8 shade) const
+{
+	float radius = kSelectorSize / 2 + kSelectorPenSize / 2;
+	
+	return BPoint(rampRect.left + kSelectorHSpacing + radius + 
+		shade * (rampRect.Width() - 2 * (kSelectorHSpacing + radius)) / 255,
+		rampRect.top + rampRect.Height() / 2);
+}
+
+
 void
 BColorControl::_UpdateOffscreen(BRect update)
 {
@@ -572,21 +586,19 @@
 
 	rgb_color color = ValueAsColor();
 
-	float rampsize = rect.bottom / 4;
-
 	uint8 shade = (unsigned char)max_c(0,
-		min_c((point.x - 2) * 255 / (rect.Width() - 4.0f), 255));
-
-	if (point.y - 2 < rampsize) {
+		 min_c((point.x - fRampRects[0].left) * 255 / fRampRects[0].Width(), 255));
+	
+	if (fRampRects[0].Contains(point)) {
 		color.red = color.green = color.blue = shade;
 		fFocusedComponent = 1;
-	} else if (point.y - 2 < (rampsize * 2)) {
+	} else if (fRampRects[1].Contains(point)) {
 		color.red = shade;
 		fFocusedComponent = 2;
-	} else if (point.y - 2 < (rampsize * 3)) {
+	} else if (fRampRects[2].Contains(point)) {
 		color.green = shade;
 		fFocusedComponent = 3;
-	} else {
+	} else if (fRampRects[3].Contains(point)){
 		color.blue = shade;
 		fFocusedComponent = 4;
 	}
@@ -609,11 +621,9 @@
 	
 	rgb_color color = ValueAsColor();
 
-	BRect rect(0.0f, 0.0f, fColumns * fCellSize, Bounds().bottom);
-
 	uint8 shade = (unsigned char)max_c(0,
-		min_c((point.x - 2) * 255 / (rect.Width() - 4.0f), 255));
-
+		min_c((point.x - fRampRects[0].left) * 255 / fRampRects[0].Width(), 255));
+	
 	switch (fFocusedComponent) {
 		case 1:
 			color.red = color.green = color.blue = shade;
Index: headers/os/interface/ColorControl.h
===================================================================
--- headers/os/interface/ColorControl.h	(revision 23303)
+++ headers/os/interface/ColorControl.h	(working copy)
@@ -92,8 +92,11 @@
 		void				_ColorRamp(BRect rect, BView* target,
 								rgb_color baseColor, int16 flag,
 								bool focused);
+		BPoint				_SelectorPosition(const BRect& rampRect, uint8 shade) const;
 
 	private:
+		BRect				fRampRects[4];
+		
 		float				fCellSize;
 		int32				fRows;
 		int32				fColumns;
