[gimp] app: Smoother zooming while dragging with the mouse
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Smoother zooming while dragging with the mouse
- Date: Tue, 5 Apr 2022 13:08:17 +0000 (UTC)
commit 8b1025919f374e4885c575b264fcf76916193767
Author: woob <thetoastcaper gmail com>
Date: Mon Feb 7 20:06:01 2022 -0500
app: Smoother zooming while dragging with the mouse
Changes the behavior of gimp_display_shell_scale_drag() to factor in
the distance dragged, rather than just scaling a flat +/- 10% for each
detected movement event. The factor by which to change the scaling is
also altered from 10% at each movement event, to 1% compounded for
each pixel of distance dragged.
This makes zooming via Ctrl + Middle Click or Ctrl + Spacebar behave
more consistently and less jittery versus the previous method, while
offering more fine grained control.
app/display/gimpdisplayshell-scale.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index 24c7d234f9..4c2450fcbf 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -813,20 +813,10 @@ gimp_display_shell_scale_drag (GimpDisplayShell *shell,
{
gimp_display_shell_push_zoom_focus_pointer_pos (shell, start_x, start_y);
- if (delta_y > 0.0)
- {
- gimp_display_shell_scale (shell,
- GIMP_ZOOM_TO,
- scale * 1.1,
- GIMP_ZOOM_FOCUS_POINTER);
- }
- else /* delta_y < 0.0 */
- {
- gimp_display_shell_scale (shell,
- GIMP_ZOOM_TO,
- scale * 0.9,
- GIMP_ZOOM_FOCUS_POINTER);
- }
+ gimp_display_shell_scale (shell,
+ GIMP_ZOOM_TO,
+ scale * exp (0.01 * delta_y),
+ GIMP_ZOOM_FOCUS_POINTER);
if (shell->zoom_focus_point)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]