-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Split CursorOptions off of Window #19668
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
Conversation
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.
I don't have the bandwidth to immediately review this in detail, but I like this direction. Required components are great here, and working change detection is very desirable!
/// Defaults to `Some(CursorOptions::default())`. | ||
/// | ||
/// Has no effect if [`WindowPlugin::primary_window`] is `None`. | ||
pub primary_cursor_options: Option<CursorOptions>, |
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.
I left this in for parity with the existing API, but since it's a required component, we could also omit it and let the user override it in an observer for OnAdd, PrimaryWindow
pub window: Window, | ||
} | ||
#[derive(Debug, Clone, Component, Deref, DerefMut)] | ||
pub(crate) struct CachedWindow(Window); |
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.
Making this pub(crate)
is not breaking, it was already de facto on that visibility.
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 good. The changes make sense and I didn't see any problems with any of the examples I tried.
/// Defaults to `Some(CursorOptions::default())`. | ||
/// | ||
/// Has no effect if [`WindowPlugin::primary_window`] is `None`. | ||
pub primary_cursor_options: Option<CursorOptions>, |
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.
It's a bit tangential but I don't really like how in the window module we use "cursor" to refer to the mouse pointer and in the UI and picking modules we use "pointer". I'd prefer using "pointer" consistently.
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.
That's a very good point. I'll open an issue for unifying terminology later :)
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.
Done and already resolved: #19688 (comment)
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.
I don't know how I feel about breaking up the window component, but if we are moving in this direction this PR is good.
@janhohenheim ping me when you're ready to try re-merging this. |
@alice-i-cecile now :) |
Objective
Window
component for more granular change detection #19644Window
has become a very very very big componentSolution
Window
into multiple components, each with working change detectionCursorOptions
were touched by the user, which is much rarer than simply moving the mouse.Window
as a follow-upTesting