1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
use crate::{Primitive, Renderer};
use iced_native::{image, image_pane, MouseCursor, Rectangle, Vector};
impl image_pane::Renderer for Renderer {
fn draw(
&mut self,
state: &image_pane::State,
bounds: Rectangle,
image_bounds: Rectangle,
offset: (u32, u32),
handle: image::Handle,
is_mouse_over: bool,
) -> Self::Output {
(
{
Primitive::Clip {
bounds,
offset: Vector::new(offset.0, offset.1),
content: Box::new(Primitive::Image {
handle,
bounds: image_bounds,
}),
}
},
{
if state.is_cursor_clicked() {
MouseCursor::Grabbing
} else if is_mouse_over {
MouseCursor::Grab
} else {
MouseCursor::OutOfBounds
}
},
)
}
}
|