summaryrefslogtreecommitdiffstats
path: root/widget/src/image/viewer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/image/viewer.rs')
-rw-r--r--widget/src/image/viewer.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/widget/src/image/viewer.rs b/widget/src/image/viewer.rs
index 20a7955f..811241a9 100644
--- a/widget/src/image/viewer.rs
+++ b/widget/src/image/viewer.rs
@@ -151,7 +151,7 @@ where
fn update(
&mut self,
tree: &mut Tree,
- event: Event,
+ event: &Event,
layout: Layout<'_>,
cursor: mouse::Cursor,
renderer: &Renderer,
@@ -167,7 +167,7 @@ where
return;
};
- match delta {
+ match *delta {
mouse::ScrollDelta::Lines { y, .. }
| mouse::ScrollDelta::Pixels { y, .. } => {
let state = tree.state.downcast_mut::<State>();
@@ -215,6 +215,7 @@ where
}
}
+ shell.request_redraw();
shell.capture_event();
}
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => {
@@ -226,6 +227,8 @@ where
state.cursor_grabbed_at = Some(cursor_position);
state.starting_offset = state.current_offset;
+
+ shell.request_redraw();
shell.capture_event();
}
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => {
@@ -233,6 +236,7 @@ where
if state.cursor_grabbed_at.is_some() {
state.cursor_grabbed_at = None;
+ shell.request_redraw();
shell.capture_event();
}
}
@@ -256,7 +260,7 @@ where
.max(0.0)
.round();
- let delta = position - origin;
+ let delta = *position - origin;
let x = if bounds.width < scaled_size.width {
(state.starting_offset.x - delta.x)
@@ -273,6 +277,7 @@ where
};
state.current_offset = Vector::new(x, y);
+ shell.request_redraw();
shell.capture_event();
}
}