I want to drag a small circle(a knob) inside a large circle. It's fine if i start the drag on the small circle. I added a call to place the small circle on the position of the left click on the large circle (so that it immediatly jumps to that position) - that's fine too. But if i do the latter then the drag event will not start, i need to release the mouse and click again on the same point. The example code below:
void LargeCircleComponent::mouseDown (const MouseEvent& e) { //[UserCode_mouseDown] -- Add your code here... if (e.eventComponent == &knob) { knobDragger.startDraggingComponent (&knob, e); } else { knob.setCentrePosition (e.x, e.y); knobDragger.startDraggingComponent (&knob, e); } //[/UserCode_mouseDown] } void LargeCircleComponent::mouseDrag (const MouseEvent& e) { //[UserCode_mouseDrag] -- Add your code here... if (e.eventComponent == &knob) knobDragger.dragComponent (&knob, e, knobDraggerConstrainer); //[/UserCode_mouseDrag] }
Is there a way to fix this or to get the behavior i want without setting some weird bool values around to detect this ?
I noticed that if I look at the result of the knob.isMouseOver() method it does not return TRUE after the knob jumped to a new position after a click on the larget circle, and that's not right since the mouse is over the small circle.