-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cursor styles API #168
Conversation
Just realized that this test is failing. Guess it's time to figure out what to do with the test, since it won't have a glfwWindow. I'm going to make it optional for now, but I'm open to refactoring this further in the future (Will definitely want to clean this up, so if anyone has some input on how you think I should do that lmk) |
Awesome! 🎉
This seems like a reasonable 'next step' to me. We need this logic to select the top-most element prior to having bubbling anyway - so this seems like it brings us closer to the logic we need in #164 .
IMO, it'd be ideal if we could keep the implementation of One option I could see for removing this coupling would be to expose an event from the
We'd also need a place to listen to that event - the place that would make sense at the moment is the place where we bind all our other events between the 'native' world and the reconciler world: https://github.com/revery-ui/revery/blob/master/src/UI/Revery_UI.re We could add a handler here, like:
It means that the The nice thing about this 'decoupling' is that it makes it easier to test, too - it gets us closer to being able to validate the logic w/o any rendering dependencies:
(I think there would still be issues as the cursors themselves depend on GLFW dependencies, but perhaps the I find that writing tests helps not only to build up our safety net but also to rationalize the dependencies and how they relate. Just some thoughts - let me know what you think! |
Thanks for all this feedback. I'll try to fix this ASAP.
Hm, so testing out something similar in utop: utop # let x = lazy (print_endline "Hi");;
val x : unit lazy_t = <lazy>
utop # let y = lazy (print_endline "Bye");;
val y : unit lazy_t = <lazy>
utop # x = y;;
Exception: Invalid_argument "compare: functional value". One workaround might be a 2-layer approach here, where layer one sets the cursor through some variant (i.e. |
Any way to force Azure CI to trigger? Doesn't seem like it picked up on any of the last few commits |
Sorry about that, @OhadRau ! Just kicked off CI. Thanks for adding the test case and abstracting out from the GLFW window implementation - looks great! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the update - and builds are green after kicking them off again 👍
Awesome, gonna go ahead and merge this in then! |
This addresses #144, implementing cursors as a style property (similar to how colors work now). I've also updated
Clickable
to use thepointer
style cursor. Example of the API:This also implements a really hacky precursor to event bubbling, where we select the top-most element below the mouse based on the depth in the DOM and choose the cursor from that node. While this works for basic cases, #164 would provide a much more flexible way of doing this (so let me know if you think I should block this until that's merged in). I also added a
Window.t
parameter toMouse.dispatch
to allow the cursor to get set in there (sinceglfwSetCursor
requires that and we always have the window in scope when callingMouse.dispatch
).Finally, here's a screenshot if you're interested in what this looks like: