Code

fix by dvlierop2 for snapping bugs 1579556 and 1579587
[inkscape.git] / src / object-edit.cpp
index 3db0f0a21837122d2a181877110297054a19c70e..2eabdd7bd480acd97a64789f9de6c635f38eb81d 100644 (file)
@@ -29,6 +29,7 @@
 #include "desktop-affine.h"
 #include <style.h>
 #include "desktop.h"
+#include "sp-namedview.h"
 
 #include "sp-pattern.h"
 #include "sp-path.h"
@@ -227,12 +228,12 @@ static void sp_rect_rx_set(SPItem *item, NR::Point const &p, NR::Point const &or
         gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
         rect->rx.computed = rect->ry.computed = CLAMP(rect->x.computed + rect->width.computed - p[NR::X], 0.0, temp);
         rect->rx._set = rect->ry._set = true;
-        
+
     } else {
         rect->rx.computed = CLAMP(rect->x.computed + rect->width.computed - p[NR::X], 0.0, rect->width.computed / 2.0);
         rect->rx._set = true;
     }
-    
+
     ((SPObject*)rect)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 }
 
@@ -248,7 +249,7 @@ static void sp_rect_ry_set(SPItem *item, NR::Point const &p, NR::Point const &or
 {
     SPRect *rect = SP_RECT(item);
 
-    if (state & GDK_CONTROL_MASK) {        
+    if (state & GDK_CONTROL_MASK) {
         gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
         rect->rx.computed = rect->ry.computed = CLAMP(p[NR::Y] - rect->y.computed, 0.0, temp);
         rect->ry._set = rect->rx._set = true;
@@ -334,7 +335,7 @@ static NR::Point rect_snap_knot_position(NR::Point const &p)
 {
     SPDesktop const *desktop = inkscape_active_desktop();
     NR::Point s = sp_desktop_dt2root_xy_point(desktop, p);
-    SnapManager const m(desktop->namedview);
+    SnapManager const &m = desktop->namedview->snap_manager;
     s = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, s, NULL).getPoint();
     return sp_desktop_root2dt_xy_point(desktop, s);
 }