ethanselzer / react-cursor-position

A React component that decorates its children with mouse and touch coordinates relative to itself.
https://ethanselzer.github.io/react-cursor-position
MIT License
143 stars 35 forks source link

Support isMouseDown? #20

Open Secretmapper opened 6 years ago

ethanselzer commented 6 years ago

@Secretmapper - Thanks for opening this issue. When you say "isMouseDown" do you mean "is the mouse button being held down", like in a text selection or drag operation?

Secretmapper commented 6 years ago

I guess it would be similar to "drag operation" yes.

As for use case, I'm planning to use this library for my image annotation library (https://github.com/Secretmapper/react-image-annotation) and isMouseDown would be useful to keep track if the user is trying to create/edit/resize his annotation 'rectangle'.

isActive sort of fits the bill for touch (since touch needs to be "held down" anyway due to the finger needing to be on the screen) but it doesn't apply to mouse as it is isActive by default (and I think isActive is just for active status of the listener?)