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 792cd581a2
)
This commit is contained in:
@ -635,6 +635,8 @@ gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
|
|||||||
|
|
||||||
void
|
void
|
||||||
gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
||||||
|
gdouble start_x,
|
||||||
|
gdouble start_y,
|
||||||
gdouble delta_x,
|
gdouble delta_x,
|
||||||
gdouble delta_y)
|
gdouble delta_y)
|
||||||
{
|
{
|
||||||
@ -644,19 +646,21 @@ gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
|||||||
|
|
||||||
scale = gimp_zoom_model_get_factor (shell->zoom);
|
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)
|
if (delta_y > 0)
|
||||||
{
|
{
|
||||||
gimp_display_shell_scale (shell,
|
gimp_display_shell_scale (shell,
|
||||||
GIMP_ZOOM_TO,
|
GIMP_ZOOM_TO,
|
||||||
scale * 1.1,
|
scale * 1.1,
|
||||||
GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
|
GIMP_ZOOM_FOCUS_POINTER);
|
||||||
}
|
}
|
||||||
else if (delta_y < 0)
|
else if (delta_y < 0)
|
||||||
{
|
{
|
||||||
gimp_display_shell_scale (shell,
|
gimp_display_shell_scale (shell,
|
||||||
GIMP_ZOOM_TO,
|
GIMP_ZOOM_TO,
|
||||||
scale * 0.9,
|
scale * 0.9,
|
||||||
GIMP_ZOOM_FOCUS_RETAIN_CENTERING_ELSE_BEST_GUESS);
|
GIMP_ZOOM_FOCUS_POINTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ void gimp_display_shell_scale_by_values (GimpDisplayShell *shell,
|
|||||||
gboolean resize_window);
|
gboolean resize_window);
|
||||||
|
|
||||||
void gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
void gimp_display_shell_scale_drag (GimpDisplayShell *shell,
|
||||||
|
gdouble start_x,
|
||||||
|
gdouble start_y,
|
||||||
gdouble delta_x,
|
gdouble delta_x,
|
||||||
gdouble delta_y);
|
gdouble delta_y);
|
||||||
|
|
||||||
|
@ -1530,6 +1530,8 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
|
|||||||
gimp_display_shell_pointer_grab (shell, event, GDK_POINTER_MOTION_MASK);
|
gimp_display_shell_pointer_grab (shell, event, GDK_POINTER_MOTION_MASK);
|
||||||
|
|
||||||
shell->scrolling = TRUE;
|
shell->scrolling = TRUE;
|
||||||
|
shell->scroll_start_x = x;
|
||||||
|
shell->scroll_start_y = y;
|
||||||
shell->scroll_last_x = x;
|
shell->scroll_last_x = x;
|
||||||
shell->scroll_last_y = y;
|
shell->scroll_last_y = y;
|
||||||
shell->rotating = (state & gimp_get_extend_selection_mask ()) ? TRUE : FALSE;
|
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);
|
gimp_display_shell_unset_override_cursor (shell);
|
||||||
|
|
||||||
shell->scrolling = FALSE;
|
shell->scrolling = FALSE;
|
||||||
|
shell->scroll_start_x = 0;
|
||||||
|
shell->scroll_start_y = 0;
|
||||||
shell->scroll_last_x = 0;
|
shell->scroll_last_x = 0;
|
||||||
shell->scroll_last_y = 0;
|
shell->scroll_last_y = 0;
|
||||||
shell->rotating = FALSE;
|
shell->rotating = FALSE;
|
||||||
@ -1591,6 +1595,8 @@ gimp_display_shell_handle_scrolling (GimpDisplayShell *shell,
|
|||||||
else if (shell->scaling)
|
else if (shell->scaling)
|
||||||
{
|
{
|
||||||
gimp_display_shell_scale_drag (shell,
|
gimp_display_shell_scale_drag (shell,
|
||||||
|
shell->scroll_start_x,
|
||||||
|
shell->scroll_start_y,
|
||||||
shell->scroll_last_x - x,
|
shell->scroll_last_x - x,
|
||||||
shell->scroll_last_y - y);
|
shell->scroll_last_y - y);
|
||||||
}
|
}
|
||||||
|
@ -199,6 +199,8 @@ struct _GimpDisplayShell
|
|||||||
const gchar *space_shaded_tool;
|
const gchar *space_shaded_tool;
|
||||||
|
|
||||||
gboolean scrolling;
|
gboolean scrolling;
|
||||||
|
gint scroll_start_x;
|
||||||
|
gint scroll_start_y;
|
||||||
gint scroll_last_x;
|
gint scroll_last_x;
|
||||||
gint scroll_last_y;
|
gint scroll_last_y;
|
||||||
gboolean rotating;
|
gboolean rotating;
|
||||||
|
Reference in New Issue
Block a user