Split CursorOptions off of Window#19668
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
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.
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.
Making this pub(crate) is not breaking, it was already de facto on that visibility.
ickshonpe
left a comment
There was a problem hiding this comment.
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.
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.
That's a very good point. I'll open an issue for unifying terminology later :)
IceSentry
left a comment
There was a problem hiding this comment.
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
Windowcomponent for more granular change detection #19644Windowhas become a very very very big componentSolution
Windowinto multiple components, each with working change detectionCursorOptionswere touched by the user, which is much rarer than simply moving the mouse.Windowas a follow-upTesting