Feature Mouse Lock API
Trying to investigate on #1602 Seems awesome.
https://user-images.githubusercontent.com/707007/167320729-9f56e8a9-47bc-4a0f-942b-2af1bd6ce01c.mp4
There is a demo you can try your own
Some todos: don't change position on emit release event. For some reason if we lose focus while dragging, we would not get release event and cant unlock cursor
Just realized I can use https://docs.rs/winit/latest/winit/event/enum.DeviceEvent.html#variant.MouseMotion for delta to modify DragValue just by delta and thats all.
converted to draft since you still have some todos
Just want you to check out and write what do you think. Is it worth feature of it costs?
Btw first todo was fixed, and second todo - looks like a bug in winit. browser behave the same way. and looks like we can turn off locking in each component by asking clicked_anywhere.
I think we can add this as experimental feature anyway, but I already happy with my deltas, so I can enjoy DragValue. I just worried about excess complexity. If you are okay with that I'll polish this.
Thank you for reply
This could be merged now I guess
is it really worth the added complexity?
is it really worth the added complexity?
If we dont merge it, anybody who want this must do it from scratch. If we merge this - this add just few odd, experimental methods that could motivate someone to play with this.
I really dont know. perhaps there should be some voting process about it. As for me, the solution is not very kludgy.
Not sure how hard this would be to get across the line, but it is something I'm hoping egui could provide an api for. Very useful for things like draggable values — anyone using Figma will have likely appreciated it when dragging a value and the cursor wraps around the screen, rather than hitting the right edge of the screen and stopping.