Slider component small addition


#1

i just added a couples of lines in Slider::restoreMouseIfHidden

else if (style == Rotary ) Desktop::setMousePosition (getScreenX() + getWidth() / 2, getScreenY() + getHeight() / 2);

i would like to restore the mouse (when hidden) in the middle of the rotary control. but i’m trying it and seems that get ignored by the controls.

[code]void Slider::restoreMouseIfHidden()
{
if (mouseWasHidden)
{
mouseWasHidden = false;

    Component* c = Component::getComponentUnderMouse();

    if (c == 0)
        c = this;

    c->enableUnboundedMouseMovement (false);

    if (style == LinearHorizontal || style == LinearBar)
        Desktop::setMousePosition (getScreenX() + (int) getLinearSliderPos(),
                                   getScreenY() + getHeight() / 2);
    else if (style == LinearVertical)
        Desktop::setMousePosition (getScreenX() + getWidth() / 2,
                                   getScreenY() + (int) getLinearSliderPos());
	else if (style == Rotary )
        Desktop::setMousePosition (getScreenX() + getWidth() / 2,
                                   getScreenY() + getHeight() / 2);
}

}[/code]

i’m mistaking something ?

lou


#2

:shock:
oh… i just found it out, was using the wrong style…

else if (style == RotaryVerticalDrag || style == RotaryHorizontalDrag ) Desktop::setMousePosition (getScreenX() + getWidth() / 2, getScreenY() + getHeight() / 2);

lou


#3

good point - I’ll add that. Thanks.


#4