dikalo/lienzo-core

[Wires] Issues when using mediators (zoom, pan)

Closed this issue · 3 comments

When using mediators, like zooming or panning, some features are not working properly.

These are the identified issues:

  • With panning (Alt + Shit + Click + Mouse move)
    ** Once selecting an area, the selection area delimiter (blue rectangle) is displayed at the wrong location

  • With zooming (Ctrl + Mouse wheel)
    ** Just moving (dragging) a shape to some location, or trying to add as a child or dock in some parent shape, it results in the wrong location as the specified by once droppoing
    ** Once selecting an area, the selection area delimiter (blue rectangle) is displayed using the wrong size

Notice all above issues can even occur simultaneously when combining both panning and zooming ...

Related to https://issues.jboss.org/browse/JBPM-7118

I fixed the selection rectangle with panning on this commit (WIP).

About the zoom, I also fixed the wrong location too, changing WiresShapeHandler, line 140, to:
control.onMove(event.getDragContext().getDistanceAdjusted().getX(), event.getDragContext().getDistanceAdjusted().getY());

It was using just getDragContext().getDy() before, not the distance adjusted.

But although now it drops on the correct location, it still doesn't find correct parent, for selection effect and for drop. :(

What I found out is that ColorMapBackedPicker, method findShapeAt (line 106), the x and y parameters are set with wrong values. If the zoom is little, the error is almost imperceptible. But if the zoom is bigger (zoom in or out), it becomes clear as we move the mouse while dragging.

So what I found is that the source of that wrong values is DragContext, method dragUpdate (line 176).

Just for debug purpose, I changed m_drag.adjust(m_lclp); to m_drag.adjust(new Point2D(m_dstx, m_dsty)); and it worked for highlight effect, but it breaks other features (like alignment).

I'm still investigating more.

Any ideas? Thank you!!

Fixed in #218 . It's working. @mdproctor