Introduce CursorRegion struct
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene. Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
f4d13ef596
commit
0866f0ed55
6 changed files with 44 additions and 24 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
|||
vector::{vec2f, Vector2F},
|
||||
},
|
||||
platform::CursorStyle,
|
||||
scene::CursorRegion,
|
||||
DebugContext, Element, ElementBox, ElementStateContext, ElementStateHandle, Event,
|
||||
EventContext, LayoutContext, PaintContext, SizeConstraint,
|
||||
};
|
||||
|
@ -100,9 +101,11 @@ impl Element for MouseEventHandler {
|
|||
_: &mut Self::LayoutState,
|
||||
cx: &mut PaintContext,
|
||||
) -> Self::PaintState {
|
||||
if let Some(cursor_style) = self.cursor_style {
|
||||
cx.scene
|
||||
.push_cursor_style(self.hit_bounds(bounds), cursor_style);
|
||||
if let Some(style) = self.cursor_style {
|
||||
cx.scene.push_cursor_region(CursorRegion {
|
||||
bounds: self.hit_bounds(bounds),
|
||||
style,
|
||||
});
|
||||
}
|
||||
self.child.paint(bounds.origin(), visible_bounds, cx);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue