Code

Refactoring SPColor to C++ and removing legacy CMYK implementation
[inkscape.git] / src / context-fns.cpp
index 5db98ec16955f107703ecf5296ef4a6f601d5de2..8a131b081952a7b7d595eabf2af09e5222c48ece 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <glibmm/i18n.h>
 #include "sp-item.h"
 #include "desktop.h"
@@ -108,12 +112,12 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
             Inkscape::SnappedPoint s[2];
 
             /* Try to snap p[0] (the opposite corner) along the constraint vector */
-            s[0] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT,
-                                     p[0], p[0] - p[1], item);
+            s[0] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[0],
+                                     Inkscape::Snapper::ConstraintLine(p[0] - p[1]), item);
 
             /* Try to snap p[1] (the dragged corner) along the constraint vector */
-            s[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT,
-                                     p[1], p[1] - p[0], item);
+            s[1] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1],
+                                     Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item);
 
             /* Choose the best snap and update points accordingly */
             if (s[0].getDistance() < s[1].getDistance()) {
@@ -128,7 +132,8 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
 
             /* Our origin is the opposite corner.  Snap the drag point along the constraint vector */
             p[0] = center;
-            p[1] = m.constrainedSnap(Inkscape::Snapper::SNAP_POINT, p[1], p[1] - p[0], item).getPoint();
+            p[1] = m.constrainedSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1],
+                                     Inkscape::Snapper::ConstraintLine(p[1] - p[0]), item).getPoint();
         }
 
     } else if (shift) {
@@ -142,8 +147,8 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
 
         Inkscape::SnappedPoint s[2];
 
-        s[0] = m.freeSnap(Inkscape::Snapper::SNAP_POINT, p[0], item);
-        s[1] = m.freeSnap(Inkscape::Snapper::SNAP_POINT, p[1], item);
+        s[0] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[0], item);
+        s[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p[1], item);
 
         if (s[0].getDistance() < s[1].getDistance()) {
             p[0] = s[0].getPoint();
@@ -157,7 +162,7 @@ NR::Rect Inkscape::snap_rectangular_box(SPDesktop const *desktop, SPItem *item,
 
         /* There's no constraint on the corner point, so just snap it to anything */
         p[0] = center;
-        p[1] = m.freeSnap(Inkscape::Snapper::SNAP_POINT, pt, item).getPoint();
+        p[1] = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, pt, item).getPoint();
     }
 
     p[0] = sp_desktop_dt2root_xy_point(desktop, p[0]);