react-simple-maps icon indicating copy to clipboard operation
react-simple-maps copied to clipboard

Retuned Position object from ZoomableGroup doesn't correspond to Center

Open jwmann opened this issue 5 years ago • 2 comments

I'm try to control the drag boundaries using onMoveStart and onMoveEnd but the position object it returns doesn't return anything to do with the last center value.

In fact, looking at the code, it seems to return the difference between the pointer's x/y start and end. https://github.com/zcreativelabs/react-simple-maps/blob/ce074907273605ad3be3a879d24b5fbea18630c1/src/components/useZoomPan.js#L55-L91

However, these values are almost useless when you're zoomed in any degree. Trying to determine the center based on the distance dragged from the mouse is crazy.

I'm also getting insane acceleration when dragging while zoomed in, which part of the reason why I'm trying to track these events.

jwmann avatar Feb 17 '20 22:02 jwmann

I am also interested on this :)

elbys avatar Mar 09 '20 10:03 elbys

With v2 this should now be possible. With translateExtent you should be able to limit the drag boundaries like with d3-zoom.

zimrick avatar Mar 27 '20 18:03 zimrick