[gimp/gimp-2-10] Issue #1531 - Zooming with mouse movement should keep track of original point
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #1531 - Zooming with mouse movement should keep track of original point
- Date: Mon, 4 Jun 2018 09:48:11 +0000 (UTC)
commit f6766cbc876189469047db794e73ab32e3d17774
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 4 11:42:02 2018 +0200
Issue #1531 - Zooming with mouse movement should keep track of original point
When Control-Button2-Zooming, remember the start point, pass it to
gimp_display_shell_scale_drag() and force gimp_display_shell_scale()
to zoom around that point by passing GIMP_ZOOM_FOCUS_POINTER and
faking the point using gimp_display_shell_push_zoom_focus_pointer_pos().
(cherry picked from commit 792cd581a2157084f384d9e5f0a0e84b4ddd74fe)
app/display/gimpdisplayshell-scale.c | 8 ++++++--
app/display/gimpdisplayshell-scale.h | 2 ++
app/display/gimpdisplayshell-tool-events.c | 6 ++++++
app/display/gimpdisplayshell.h | 2 ++
4 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index ffbb83ce59..7a5a7a6dc8 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -635,6 +635,8 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
void
gimp_display_shell_scale_drag (GimpDisplayShell *shell,
+ gdouble start_x,
+ gdouble start_y,
gdouble delta_x,
gdouble delta_y)
{
@@ -644,19 +646,21 @@ gimp_display_shell_scale_drag (GimpDisplayShell *shell,
scale = gimp_zoom_model_get_factor (shell->zoom);
+ gimp_display_shell_push_zoom_focus_pointer_pos (shell, start_x, start_y);
+
if (delta_y > 0)
{
gimp_display_shell_scale (shell,
GIMP_ZOOM_TO,
scale * 1.1,
- GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
+ GIMP_ZOOM_FOCUS_POINTER);
}
else if (delta_y < 0)
{
gimp_display_shell_scale (shell,
GIMP_ZOOM_TO,
scale * 0.9,
- GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
+ GIMP_ZOOM_FOCUS_POINTER);
}
}
diff --git a/app/display/gimpdisplayshell-scale.h b/app/display/gimpdisplayshell-scale.h
index bb1f0ac7b1..530f0e8bef 100644
--- a/app/display/gimpdisplayshell-scale.h
+++ b/app/display/gimpdisplayshell-scale.h
@@ -61,6 +61,8 @@ void gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
gboolean resize_window);
void gimp_display_shell_scale_drag (GimpDisplayShell *shell,
+ gdouble start_x,
+ gdouble start_y,
gdouble delta_x,
gdouble delta_y);
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 95b55f5355..7ca55ab74b 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1530,6 +1530,8 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
gimp_display_shell_pointer_grab (shell, event, GDK_POINTER_MOTION_MASK);
shell->scrolling = TRUE;
+ shell->scroll_start_x = x;
+ shell->scroll_start_y = y;
shell->scroll_last_x = x;
shell->scroll_last_y = y;
shell->rotating = (state & gimp_get_extend_selection_mask ()) ? TRUE : FALSE;
@@ -1556,6 +1558,8 @@ gimp_display_shell_stop_scrolling (GimpDisplayShell *shell,
gimp_display_shell_unset_override_cursor (shell);
shell->scrolling = FALSE;
+ shell->scroll_start_x = 0;
+ shell->scroll_start_y = 0;
shell->scroll_last_x = 0;
shell->scroll_last_y = 0;
shell->rotating = FALSE;
@@ -1591,6 +1595,8 @@ gimp_display_shell_handle_scrolling (GimpDisplayShell *shell,
else if (shell->scaling)
{
gimp_display_shell_scale_drag (shell,
+ shell->scroll_start_x,
+ shell->scroll_start_y,
shell->scroll_last_x - x,
shell->scroll_last_y - y);
}
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index b00f975f04..e1018338c3 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -199,6 +199,8 @@ struct _GimpDisplayShell
const gchar *space_shaded_tool;
gboolean scrolling;
+ gint scroll_start_x;
+ gint scroll_start_y;
gint scroll_last_x;
gint scroll_last_y;
gboolean rotating;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]