yfede
June 23, 2010, 10:28am
1
I’m updating some old code that used enableUnboundedMouseMovement this way:
[code]void HeaderPanel::sliderDragStarted(Slider* slider)
{
if(slider == outLevelSlider)
{
filter->beginParameterChangeGesture(hostIndex_OutLevel);
}
// do other stuff…
slider->enableUnboundedMouseMovement(slider->getSliderStyle() != Slider::Rotary);
}
void HeaderPanel::sliderDragEnded(Slider* slider)
{
slider->enableUnboundedMouseMovement(false);
}
[/code]
This stopped being compiled since the unbounded mouse movement handling has been moved into MouseInputSource. What’s the cleanest way to achieve the same effect as before with the new refactoring?
jules
June 23, 2010, 10:32am
2
Probably Desktop::getInstance().getDraggingMouseSource (0)->enableUnboundedMouseMovement (true). (better check that it’s not a null pointer though).
You don’t really need to worry about disabling it, as that’ll happen when they let go anyway.
yfede
July 22, 2010, 10:43am
3
Some code needs to be changed regarding this subject:
Line 377 of juce_MouseInputSource.cpp
Desktop::setMousePosition (current->getScreenBounds()
.getConstrainedPoint (current->getMouseXYRelative()));
is not conceptually correct, should be replaced with
Desktop::setMousePosition (current->relativePositionToGlobal (current->getLocalBounds()
.getConstrainedPoint (current->getMouseXYRelative())));
Do you agree?
jules
July 22, 2010, 11:53pm
4
Ah yes, you’re right. I think what I probably meant to write was actually just:
Desktop::setMousePosition (current->getScreenBounds().getConstrainedPoint (lastScreenPos));