this time I feel very lazy, and I’m gonna ask for a fast solution (from you!)…
All my Draggable displays aren’t working because something is changed in the coordinate system
I used to have a working xform
sequence is/was this:
a) entering in onDragStart
b) getting current mouse position VEC (APP->scene->getMousePos())
c) convert to PARENT coord with a global2parent(), something like in_global_vec.minus(this->parent->box.pos);
d) convert to LOCAL coor with a parent2local, something like in_parent_vec.minus(this->box.pos)
now this sequence is not working anymore
Do you know how to get the local position of the mouse in a human way (I’m still using stuff I created in 0.5 and maybe I’ve missed something “new” )
That seems like the “proper” way to do it, since a) it works and is portable and b) if there is a difference between the coordinates in the mouse event and the current mouse position, you would typically want the former. i.e. “where did the user click” vs. “where is the mouse right now”.
Your (a-d) sequence seems very complicated and britle. Just override Widget::onDragHover(const DragHoverEvent& e). The vector e.pos contains the pixel coordinate of the mouse cursor, relative to the widget.
because was introduced in 1.0 and I had too many changes to do to support coordinates from the onDragHover and as my xfrom was correctly working (and I know that is the same xform in the “recurse” inner methods in VCVRack) I decided to leave in place my global2local method
but I’ll change immediately if you extend the
const event::DragStart& e
event to contains also the Mouse VEC local position (that you already have, because is precomputed for Button) !