Rename MouseCursor to mouse::Interaction
This commit is contained in:
parent
d4c4198f72
commit
98bc8cf2a7
35 changed files with 170 additions and 171 deletions
|
|
@ -9,8 +9,8 @@
|
|||
use crate::{Defaults, Primitive, Renderer};
|
||||
|
||||
use iced_native::{
|
||||
layout, Clipboard, Element, Hasher, Layout, Length, MouseCursor, Point,
|
||||
Size, Vector, Widget,
|
||||
layout, mouse, Clipboard, Element, Hasher, Layout, Length, Point, Size,
|
||||
Vector, Widget,
|
||||
};
|
||||
use std::hash::Hash;
|
||||
use std::marker::PhantomData;
|
||||
|
|
@ -192,7 +192,7 @@ impl<Message, P: Program<Message>> Widget<Message, Renderer>
|
|||
_defaults: &Defaults,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> (Primitive, MouseCursor) {
|
||||
) -> (Primitive, mouse::Interaction) {
|
||||
let bounds = layout.bounds();
|
||||
let translation = Vector::new(bounds.x, bounds.y);
|
||||
let cursor = Cursor::from_window_position(cursor_position);
|
||||
|
|
@ -209,7 +209,7 @@ impl<Message, P: Program<Message>> Widget<Message, Renderer>
|
|||
.collect(),
|
||||
}),
|
||||
},
|
||||
self.program.mouse_cursor(bounds, cursor),
|
||||
self.program.mouse_interaction(bounds, cursor),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::canvas::{Cursor, Event, Geometry};
|
||||
use iced_native::{MouseCursor, Rectangle};
|
||||
use iced_native::{mouse, Rectangle};
|
||||
|
||||
/// The state and logic of a [`Canvas`].
|
||||
///
|
||||
|
|
@ -42,15 +42,19 @@ pub trait Program<Message> {
|
|||
/// [`Cache`]: struct.Cache.html
|
||||
fn draw(&self, bounds: Rectangle, cursor: Cursor) -> Vec<Geometry>;
|
||||
|
||||
/// Returns the mouse cursor state of the [`Program`].
|
||||
/// Returns the current mouse interaction of the [`Program`].
|
||||
///
|
||||
/// The mouse cursor returned will be in effect even if the cursor position
|
||||
/// The interaction returned will be in effect even if the cursor position
|
||||
/// is out of bounds of the program's [`Canvas`].
|
||||
///
|
||||
/// [`Program`]: trait.Program.html
|
||||
/// [`Canvas`]: struct.Canvas.html
|
||||
fn mouse_cursor(&self, _bounds: Rectangle, _cursor: Cursor) -> MouseCursor {
|
||||
MouseCursor::default()
|
||||
fn mouse_interaction(
|
||||
&self,
|
||||
_bounds: Rectangle,
|
||||
_cursor: Cursor,
|
||||
) -> mouse::Interaction {
|
||||
mouse::Interaction::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +75,11 @@ where
|
|||
T::draw(self, bounds, cursor)
|
||||
}
|
||||
|
||||
fn mouse_cursor(&self, bounds: Rectangle, cursor: Cursor) -> MouseCursor {
|
||||
T::mouse_cursor(self, bounds, cursor)
|
||||
fn mouse_interaction(
|
||||
&self,
|
||||
bounds: Rectangle,
|
||||
cursor: Cursor,
|
||||
) -> mouse::Interaction {
|
||||
T::mouse_interaction(self, bounds, cursor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue