Remove now redundant Overlay::is_over
The `mouse_interaction` method can be properly used now to encode hover status with the `None` and `Idle` variants.
This commit is contained in:
parent
a01beefa84
commit
9e934fe2a7
15 changed files with 92 additions and 256 deletions
|
|
@ -10,7 +10,7 @@ use crate::mouse;
|
|||
use crate::renderer;
|
||||
use crate::widget;
|
||||
use crate::widget::Tree;
|
||||
use crate::{Clipboard, Event, Layout, Point, Rectangle, Shell, Size, Vector};
|
||||
use crate::{Clipboard, Event, Layout, Rectangle, Shell, Size, Vector};
|
||||
|
||||
/// An interactive component that can be displayed on top of other widgets.
|
||||
pub trait Overlay<Message, Theme, Renderer>
|
||||
|
|
@ -69,30 +69,16 @@ where
|
|||
|
||||
/// Returns the current [`mouse::Interaction`] of the [`Overlay`].
|
||||
///
|
||||
/// By default, it returns [`mouse::Interaction::Idle`].
|
||||
/// By default, it returns [`mouse::Interaction::None`].
|
||||
fn mouse_interaction(
|
||||
&self,
|
||||
_layout: Layout<'_>,
|
||||
_cursor: mouse::Cursor,
|
||||
_viewport: &Rectangle,
|
||||
_renderer: &Renderer,
|
||||
) -> mouse::Interaction {
|
||||
mouse::Interaction::None
|
||||
}
|
||||
|
||||
/// Returns true if the cursor is over the [`Overlay`].
|
||||
///
|
||||
/// By default, it returns true if the bounds of the `layout` contain
|
||||
/// the `cursor_position`.
|
||||
fn is_over(
|
||||
&self,
|
||||
layout: Layout<'_>,
|
||||
_renderer: &Renderer,
|
||||
cursor_position: Point,
|
||||
) -> bool {
|
||||
layout.bounds().contains(cursor_position)
|
||||
}
|
||||
|
||||
/// Returns the nested overlay of the [`Overlay`], if there is any.
|
||||
fn overlay<'a>(
|
||||
&'a mut self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue