display, tools: use gimp_display_shell_untransform_xy_f...
... to get limits in image coordinates instead of gimp_ruler_get_range. Rulers return values in the active unit (e.g. mm, inches), while the overlay logic works in pixels. This unit mismatch caused incorrect clamping of the text overlay position, making it jump when dragging if the unit wasn't set to pixels.
This commit is contained in:
parent
8e5f04a570
commit
651ec04744
2 changed files with 22 additions and 10 deletions
|
|
@ -1281,13 +1281,22 @@ gimp_display_shell_overlay_allocate (GtkWidget *child,
|
|||
GtkAllocation *allocation,
|
||||
GimpDisplayShellOverlay *overlay)
|
||||
{
|
||||
gdouble tlx, tly, brx, bry;
|
||||
gdouble llimit, rlimit, ulimit, blimit;
|
||||
gdouble tlx;
|
||||
gdouble tly;
|
||||
gdouble brx;
|
||||
gdouble bry;
|
||||
gdouble llimit;
|
||||
gdouble rlimit;
|
||||
gdouble ulimit;
|
||||
gdouble blimit;
|
||||
|
||||
gimp_ruler_get_range ((GimpRuler *) overlay->shell->hrule,
|
||||
&llimit, &rlimit, NULL);
|
||||
gimp_ruler_get_range ((GimpRuler *) overlay->shell->vrule,
|
||||
&ulimit, &blimit, NULL);
|
||||
gimp_display_shell_untransform_xy_f (overlay->shell,
|
||||
0.0, 0.0,
|
||||
&llimit, &ulimit);
|
||||
gimp_display_shell_untransform_xy_f (overlay->shell,
|
||||
(gdouble) overlay->shell->disp_width,
|
||||
(gdouble) overlay->shell->disp_height,
|
||||
&rlimit, &blimit);
|
||||
|
||||
gimp_display_shell_get_overlay_corners (overlay->shell,
|
||||
child,
|
||||
|
|
|
|||
|
|
@ -2091,10 +2091,13 @@ gimp_text_tool_style_overlay_button_motion (GtkWidget *widget,
|
|||
x, y,
|
||||
&x, &y);
|
||||
|
||||
gimp_ruler_get_range ((GimpRuler *) shell->hrule,
|
||||
&llimit, &rlimit, NULL);
|
||||
gimp_ruler_get_range ((GimpRuler *) shell->vrule,
|
||||
&ulimit, &blimit, NULL);
|
||||
gimp_display_shell_untransform_xy_f (shell,
|
||||
0.0, 0.0,
|
||||
&llimit, &ulimit);
|
||||
gimp_display_shell_untransform_xy_f (shell,
|
||||
(gdouble) shell->disp_width,
|
||||
(gdouble) shell->disp_height,
|
||||
&rlimit, &blimit);
|
||||
|
||||
gimp_display_shell_get_overlay_corners (shell, text_tool->style_overlay,
|
||||
x, y,
|
||||
|
|
|
|||
Loading…
Reference in a new issue