react-drag-to-select icon indicating copy to clipboard operation
react-drag-to-select copied to clipboard

Make it work in zoomed context

Open jamesyu opened this issue 3 years ago • 3 comments

I'm using this in a "infinite" div which allows zooming using css transfrom scale property. When scaled, the position of the box is in correct because it is positioning based on non-zoomed coordinates. Is there a way to compensate for this?

I could calculate the new coordinates manually on selection change, but I don't know how I can use that to influence the box on selection start. Any tips?

jamesyu avatar Nov 15 '22 22:11 jamesyu

@jamesyu sorry for the late reply. we definitely haven't accounted for this sort of solution. if you come up with something, would you mind sharing with us so we could considering putting it into the package if we think it's appropriate?

dwilt avatar Jan 09 '23 20:01 dwilt

I think an option to pass a zoomfactor (e.g. 1.2, 2.0, 3.0) that would move the selection box back to the tip of the cursor, or any other any way to manipulate where the box spawns on the screen would be beneficial.

sascharissling avatar Jan 31 '23 14:01 sascharissling

@sascharissling would you be willing to contribute a PR? It's outside the scope of what we need this plugin for but would be happy to accept a PR!

dwilt avatar Apr 17 '23 13:04 dwilt