Implement basic cursor availability

This commit is contained in:
Héctor Ramón Jiménez 2023-06-08 20:11:59 +02:00
parent c15f1b5f65
commit 34451bff18
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
55 changed files with 731 additions and 886 deletions

View file

@ -6,8 +6,8 @@ use crate::core::overlay;
use crate::core::renderer;
use crate::core::widget::{Operation, Tree};
use crate::core::{
Alignment, Clipboard, Element, Length, Padding, Pixels, Point, Rectangle,
Shell, Widget,
Alignment, Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell,
Widget,
};
/// A container that distributes its contents horizontally.
@ -155,7 +155,7 @@ where
tree: &mut Tree,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
renderer: &Renderer,
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
@ -169,7 +169,7 @@ where
state,
event.clone(),
layout,
cursor_position,
cursor,
renderer,
clipboard,
shell,
@ -182,7 +182,7 @@ where
&self,
tree: &Tree,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
viewport: &Rectangle,
renderer: &Renderer,
) -> mouse::Interaction {
@ -192,11 +192,7 @@ where
.zip(layout.children())
.map(|((child, state), layout)| {
child.as_widget().mouse_interaction(
state,
layout,
cursor_position,
viewport,
renderer,
state, layout, cursor, viewport, renderer,
)
})
.max()
@ -210,7 +206,7 @@ where
theme: &Renderer::Theme,
style: &renderer::Style,
layout: Layout<'_>,
cursor_position: Point,
cursor: mouse::Cursor,
viewport: &Rectangle,
) {
for ((child, state), layout) in self
@ -219,15 +215,9 @@ where
.zip(&tree.children)
.zip(layout.children())
{
child.as_widget().draw(
state,
renderer,
theme,
style,
layout,
cursor_position,
viewport,
);
child
.as_widget()
.draw(state, renderer, theme, style, layout, cursor, viewport);
}
}