diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 1b54c981c25c8277917bc8477283972d549e2485..73b8dc36dbf3a1c2fda0079aa573c5748b17513b 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
}
SPCurve *
-SPCurve::new_from_rect(Geom::Rect const &rect)
+SPCurve::new_from_rect(Geom::Rect const &rect, bool all_four_sides)
{
SPCurve *c = new SPCurve();
for (int i=3; i>=1; i--) {
c->lineto(rect.corner(i));
}
- c->closepath();
+
+ if (all_four_sides) {
+ // When _constrained_ snapping to a path, the 2geom::SimpleCrosser will be invoked which doesn't consider the closing segment.
+ // of a path. Consequently, in case we want to snap to for example the page border, we must provide all four sides of the
+ // rectangle explicitly
+ c->lineto(rect.corner(0));
+ } else {
+ // ... instead of just three plus a closing segment
+ c->closepath();
+ }
return c;
}