Hello people!,
I have a problem, this code should rotate component while dragging,
this code works almost fine, the problem is that distance is always positive thus
when I drag up rotating right, and down rotating left but until I reach the component position,
suddenly rotation is switched to other side, like there is a mirror in the middle of the component,
I think if I just could get negative values for distance for below the component center,
What should I do to solve this issue?
This is really just a convenience if you really only need the magnitude of the distance. You can get the mouse down position from the event as a point using MouseEvent::getMouseDownPosition(). Then you can do you’re own calculations using that.
but apparently the getPosition() method, is a position relative (I guess) to the component transform,
so after few rotations (by dragging) the component go crazy because of negative and positive values (from the position) jump abruptly.
I tried to see the values of the position while the component is static, and they seem good.
Going from negative to positive values one by one without sudden changes.
the getPosition() behave differently only after transform is done.
What should I do next?