[gimp] 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] Issue #1531 - Zooming with mouse movement should keep track of original point
- Date: Mon, 4 Jun 2018 09:44:50 +0000 (UTC)
commit 792cd581a2157084f384d9e5f0a0e84b4ddd74fe
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().
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 62060e6fd3..37f435c3df 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -639,6 +639,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)
{
@@ -648,19 +650,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 dc7c11bddb..2fec64b81a 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1493,6 +1493,8 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
GDK_BUTTON_RELEASE_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;
@@ -1519,6 +1521,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;
@@ -1554,6 +1558,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 1fa0b4765b..ef0bdfbeed 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -198,6 +198,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]