Code

Fixed signed/unsigned problem with precision calc. Fixes bug #399604.
[inkscape.git] / src / sp-item-notify-moveto.cpp
index c8479221502de9ac02240588063c7ee0750c52f8..0bc08a2355d84f9ad0fb5143b3b0ce8fb7ddd226 100644 (file)
@@ -1,9 +1,9 @@
-/** \file 
+/** \file
  * Implementation of sp_item_notify_moveto().
  */
 
 #include <sp-item.h>
-#include <libnr/nr-matrix-translate-ops.h>
+#include <2geom/transforms.h>
 #include <sp-guide.h>
 #include <sp-item-rm-unsatisfied-cns.h>
 using std::vector;
@@ -20,15 +20,15 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin
 {
     g_return_if_fail(SP_IS_ITEM(&item));
     g_return_if_fail( unsigned(snappoint_ix) < 8 );
-    NR::Point const dir( mv_g.normal );
+    Geom::Point const dir( mv_g.normal_to_line );
     double const dir_lensq(dot(dir, dir));
     g_return_if_fail( dir_lensq != 0 );
 
-    vector<NR::Point> snappoints;
-    sp_item_snappoints(&item, SnapPointsIter(snappoints));
+    SnapPointsWithType snappoints;
+    sp_item_snappoints(&item, false, snappoints, NULL);
     g_return_if_fail( snappoint_ix < int(snappoints.size()) );
 
-    double const pos0 = dot(dir, snappoints[snappoint_ix]);
+    double const pos0 = dot(dir, snappoints[snappoint_ix].first);
     /// \todo effic: skip if mv_g is already satisfied.
 
     /* Translate along dir to make dot(dir, snappoints(item)[snappoint_ix]) == position. */
@@ -39,7 +39,7 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin
        pos0 + s * dot(dir, dir) = position.
        s * lensq(dir) = position - pos0.
        s = (position - pos0) / dot(dir, dir). */
-    NR::translate const tr( ( position - pos0 )
+    Geom::Translate const tr( ( position - pos0 )
                             * ( dir / dir_lensq ) );
     sp_item_set_i2d_affine(&item, sp_item_i2d_affine(&item) * tr);
     /// \todo Reget snappoints, check satisfied.
@@ -51,13 +51,13 @@ void sp_item_notify_moveto(SPItem &item, SPGuide const &mv_g, int const snappoin
         {
             sp_item_write_transform(&item, SP_OBJECT_REPR(&item), item.transform);
         }
-        
+
         sp_item_rm_unsatisfied_cns(item);
 #if 0 /* nyi */
         move_cn_to_front(mv_g, snappoint_ix, item.constraints);
-        /** \note If the guideline is connected to multiple snappoints of 
-         * this item, then keeping those cns in order requires that the 
-         * guide send notifications in order of increasing importance. 
+        /** \note If the guideline is connected to multiple snappoints of
+         * this item, then keeping those cns in order requires that the
+         * guide send notifications in order of increasing importance.
          */
 #endif
     }