Open billy5982 opened 1 day ago
It doesn't have to be the same - what if container was resized?
Oh, I wasn't aware of that! My mistake! Thank you for your accurate and kind reply! I was able to think again. Thank you!
@tomaszczura I'm so sorry. Can I ask you one more question because there's something I don't understand?? Is it different from declaring and using 'rect = containerRef.current?.getParentBoundingClientRect();' instead of 'rect' factor in 'getPointFromEvent' function?
That's a good question. Now I see that getPointFromEvent
is called with rect
param only in one place, and containerRef.current?.getParentBoundingClientRect();
is passed there. So this param could be removed, since it is not really used
Thank you so much for the good response! Can I register 'pr' for that? @tomaszczura
Sure, any help is appreciated ;)
@tomaszczura Thank you so much for your kind reply and confirmation.
In all cases where the getPointFromEvent function is used, rect is passed as getParentBoundingClientRect(). Is there any specific reason for explicitly providing rect as an argument when it's always the same value?
https://github.com/AirLabsTeam/react-drag-to-select/blob/7ae9ada562d4ebfa288a0079929dd0993b97e2ff/src/hooks/useSelectionLogic.ts#L98