Avoid setting the value when clicked outside the color ramp area, but still inside the view's bounds. Unfortunately this also 'hides' the bug mentioned in the previous commit. Now it calls SetTracking() on mousedown/up, so that an eventual subclass can check the tracking status
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15786 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -530,15 +530,19 @@ void
|
|||||||
BColorControl::MouseUp(BPoint point)
|
BColorControl::MouseUp(BPoint point)
|
||||||
{
|
{
|
||||||
fFocusedComponent = 0;
|
fFocusedComponent = 0;
|
||||||
|
SetTracking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BColorControl::MouseDown(BPoint point)
|
BColorControl::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
|
BRect rect(0.0f, 0.0f, fColumns * fCellSize, Bounds().bottom);
|
||||||
|
if (!rect.Contains(point))
|
||||||
|
return;
|
||||||
|
|
||||||
rgb_color color = ValueAsColor();
|
rgb_color color = ValueAsColor();
|
||||||
|
|
||||||
BRect rect(0.0f, 0.0f, fColumns * fCellSize, Bounds().bottom);
|
|
||||||
float rampsize = rect.bottom / 4;
|
float rampsize = rect.bottom / 4;
|
||||||
|
|
||||||
uint8 shade = (unsigned char)max_c(0,
|
uint8 shade = (unsigned char)max_c(0,
|
||||||
@@ -561,6 +565,7 @@ BColorControl::MouseDown(BPoint point)
|
|||||||
SetValue(color);
|
SetValue(color);
|
||||||
Invoke();
|
Invoke();
|
||||||
|
|
||||||
|
SetTracking(true);
|
||||||
MakeFocus();
|
MakeFocus();
|
||||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
||||||
}
|
}
|
||||||
@@ -570,7 +575,7 @@ void
|
|||||||
BColorControl::MouseMoved(BPoint point, uint32 transit,
|
BColorControl::MouseMoved(BPoint point, uint32 transit,
|
||||||
const BMessage *message)
|
const BMessage *message)
|
||||||
{
|
{
|
||||||
if (fFocusedComponent == 0)
|
if (fFocusedComponent == 0 || !IsTracking())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rgb_color color = ValueAsColor();
|
rgb_color color = ValueAsColor();
|
||||||
@@ -578,7 +583,7 @@ BColorControl::MouseMoved(BPoint point, uint32 transit,
|
|||||||
BRect rect(0.0f, 0.0f, fColumns * fCellSize, Bounds().bottom);
|
BRect rect(0.0f, 0.0f, fColumns * fCellSize, Bounds().bottom);
|
||||||
|
|
||||||
uint8 shade = (unsigned char)max_c(0,
|
uint8 shade = (unsigned char)max_c(0,
|
||||||
min_c((point.x - 2) * 255 / (rect.Width() - 4.0f), 255));
|
min_c((point.x - 2) * 255 / (rect.Width() - 4.0f), 255));
|
||||||
|
|
||||||
switch (fFocusedComponent) {
|
switch (fFocusedComponent) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user