react-selectable icon indicating copy to clipboard operation
react-selectable copied to clipboard

Quick question about click position on selection

Open merttoka opened this issue 8 years ago • 2 comments

Is there a way to manipulate the click position getter method? I tried changing the position of SelectableGroup tag to exactly correct place but it didn't help, it still calculates offset values from the left corner of document and drawing the selection using those numbers from the left corner of my div

image

In the above screenshot, my div is separated from the left corner of the document exactly the same amount as in their differences.

Is this a bug or am I looking in the wrong direction?

merttoka avatar Sep 03 '17 23:09 merttoka

I think there's an open PR for this..

The PR include also a change that set the container to be in position relative, and will calculate the rect are from the beginning of this area instead of from the beginning of the page. Before if you include the SelectableGroup in a container with position relative or absolute with top or left different than 0 it won't work as expected anymore.

https://github.com/unclecheese/react-selectable/pull/33

Is that the issue you're experiencing?

unclecheese avatar Sep 04 '17 04:09 unclecheese

Actually, it is not that one. I am also using react-grid-layout and if I use react-selectable, let's say, in the middle element, it calculates the mouse position from documents left-top point and uses those numbers to start selection from gridItems top-left point. That's why only if the gridItem is located on the top-left corner of the screen, the selection rectangle and actual mouse position would match.

Like I said, I am not sure if this is originating from this lib or the other one.

merttoka avatar Sep 04 '17 04:09 merttoka