You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make a drag & drop module and have made a lot of progress. Right now I'm using Mouse.setCapture to track mouse moves and rendering the element being dragged based on those events.
The problem is that I don't want to capture these events. When I call setCapture then none of my other views get mouse enter/leave/etc events.
Is there a way to have something like Mouse.listen(~onMouseMove, ()) that doesn't prevent other components from getting the events?
(I'd also like this to be global, any time I tried wrapping the root of my app in a <View /> with an onMouseMove the rendering broke. I'd be open to this approach if there was a way to make it work, but the global listener just seems really convenient.)
@kyldvs - ah, ya, we really didn't have a convenient way to do this.
I like your idea of the Mouse.listen / Mouse.registerListeners API - I can see where it would be convenient vs setCapture or listening to individual <View /> elements.
(I'd also like this to be global, any time I tried wrapping the root of my app in a with an onMouseMove the rendering broke. I'd be open to this approach if there was a way to make it work, but the global listener just seems really convenient.)
Ya, unfortunately the nested <View /> impacts layouts - even if it has no style. I'd like to explore how to improve this as part of the next iteration of our component model (some thoughts in #489 ).
I think this would be a useful addition, and there is a clear use case for it in your app. A PR would definitely be welcome!
I'm also not familiar enough with all the mouse/event propagation to know if my approach is going to be slow/buggy.
This should be OK; the most expensive aspect of handling the mouse events is traversing the node hierarchy to figure out which node the mouse is 'on'. The proposed change doesn't hit that hot path though.
I'm trying to make a drag & drop module and have made a lot of progress. Right now I'm using
Mouse.setCapture
to track mouse moves and rendering the element being dragged based on those events.The problem is that I don't want to capture these events. When I call
setCapture
then none of my other views get mouse enter/leave/etc events.Is there a way to have something like
Mouse.listen(~onMouseMove, ())
that doesn't prevent other components from getting the events?(I'd also like this to be global, any time I tried wrapping the root of my app in a
<View />
with anonMouseMove
the rendering broke. I'd be open to this approach if there was a way to make it work, but the global listener just seems really convenient.)This is the code I have right now: https://github.com/kyldvs/chesster/blob/master/src/drag/Drag.re
The text was updated successfully, but these errors were encountered: