[gimp] Issue #288: Point snapping to guides does not work outside the canvas.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #288: Point snapping to guides does not work outside the canvas.
- Date: Sat, 13 Feb 2021 12:02:59 +0000 (UTC)
commit 82438728fb220d840db2eccfcba9859d326e6beb
Author: Jehan <jehan girinstud io>
Date: Sat Feb 13 01:30:51 2021 +0100
Issue #288: Point snapping to guides does not work outside the canvas.
This commit also makes snap to grid and snap to vectors work off-canvas.
Since we now have off-canvas viewing, it just makes sense that snapping
would work there too.
Note that I disable snap to grid when "Show All" is OFF. I am actually
unsure this is right (as "Show All" is a view action, and we usually
don't change behavior based on view actions; for instance snap to guides
are not disabled if guides are hidden). Yet I noticed we do this in
various other features when off-canvas. We kind of use this view flag as
a switch for features working off-canvas (for instance, color picking
works off-canvas only when "Show All" is ON). So let's keep the same
logics for now at least.
Snap to guide or snap to vectors will always work though, because guides
and vectors are always visible off-canvas (even when "Show All" is OFF).
They always have been (visible, not snappable off-canvas; now they are
both).
app/core/gimpimage-snap.c | 14 ++++++++++----
app/core/gimpimage-snap.h | 3 ++-
app/display/gimpdisplayshell.c | 3 ++-
3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpimage-snap.c b/app/core/gimpimage-snap.c
index 0b9e87007e..038ef6dbae 100644
--- a/app/core/gimpimage-snap.c
+++ b/app/core/gimpimage-snap.c
@@ -221,7 +221,8 @@ gimp_image_snap_point (GimpImage *image,
gboolean snap_to_guides,
gboolean snap_to_grid,
gboolean snap_to_canvas,
- gboolean snap_to_vectors)
+ gboolean snap_to_vectors,
+ gboolean show_all)
{
gdouble mindist_x = G_MAXDOUBLE;
gdouble mindist_y = G_MAXDOUBLE;
@@ -241,10 +242,15 @@ gimp_image_snap_point (GimpImage *image,
if (! (snap_to_guides || snap_to_grid || snap_to_canvas || snap_to_vectors))
return FALSE;
- if (x < -epsilon_x || x >= (gimp_image_get_width (image) + epsilon_x) ||
- y < -epsilon_y || y >= (gimp_image_get_height (image) + epsilon_y))
+ if (! show_all &&
+ (x < -epsilon_x || x >= (gimp_image_get_width (image) + epsilon_x) ||
+ y < -epsilon_y || y >= (gimp_image_get_height (image) + epsilon_y)))
{
- return FALSE;
+ /* Off-canvas grid is invisible unless "show all" option is
+ * enabled. So let's not snap to the invisible grid.
+ */
+ snap_to_grid = FALSE;
+ snap_to_canvas = FALSE;
}
if (snap_to_guides)
diff --git a/app/core/gimpimage-snap.h b/app/core/gimpimage-snap.h
index 70cca42d81..b0d5e4b3dd 100644
--- a/app/core/gimpimage-snap.h
+++ b/app/core/gimpimage-snap.h
@@ -43,7 +43,8 @@ gboolean gimp_image_snap_point (GimpImage *image,
gboolean snap_to_guides,
gboolean snap_to_grid,
gboolean snap_to_canvas,
- gboolean snap_to_vectors);
+ gboolean snap_to_vectors,
+ gboolean show_all);
gboolean gimp_image_snap_rectangle (GimpImage *image,
gdouble x1,
gdouble y1,
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 767f7001b8..2ca4039a40 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1655,7 +1655,8 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
snap_to_guides,
snap_to_grid,
snap_to_canvas,
- snap_to_vectors);
+ snap_to_vectors,
+ shell->show_all);
}
if (snapped)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]