Code

fix pasting style after copying a text span
[inkscape.git] / src / seltrans.cpp
index 0fd15593c78ae910c35670e33bc357a6e8354ea5..4614adb87c9dea7f1e7111f32ff983da0f4b6441 100644 (file)
@@ -359,13 +359,17 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
 
        // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements
        g_assert((_bbox_points.size() + _snap_points.size()) < 2);
-       if (_bbox_points.size() == 1) {
-               _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0));
-       } else if (_snap_points.size() == 1){
-               _desktop->snapindicator->set_new_snapsource(_snap_points.at(0));
+       if (m.snapprefs.getSnapEnabledGlobally()) {
+                       if (_bbox_points.size() == 1) {
+                               _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0));
+                       } else if (_snap_points.size() == 1){
+                               _desktop->snapindicator->set_new_snapsource(_snap_points.at(0));
+                       }
        }
     }
 
+       sp_canvas_set_snap_delay_active(_desktop->canvas, true);
+
     // The lines below are useful for debugging any snapping issues, as they'll spit out all points that are considered for snapping
 
     /*std::cout << "Number of snap points:  " << _snap_points.size() << std::endl;
@@ -432,6 +436,10 @@ void Inkscape::SelTrans::ungrab()
     _grabbed = false;
     _show_handles = true;
 
+    sp_canvas_set_snap_delay_active(_desktop->canvas, false);
+
+    _desktop->snapindicator->remove_snapsource();
+
     Inkscape::Selection *selection = sp_desktop_selection(_desktop);
     _updateVolatileState();
 
@@ -1384,7 +1392,6 @@ void sp_sel_trans_center(Inkscape::SelTrans *seltrans, SPSelTransHandle const &,
 void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
 {
     SnapManager &m = _desktop->namedview->snap_manager;
-    m.setup(_desktop, true, _items_const);
 
     /* The amount that we've moved by during this drag */
     Geom::Point dxy = xy - _point;
@@ -1399,7 +1406,8 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
         ** FIXME: this will snap to more than just the grid, nowadays.
         */
 
-        m.freeSnapReturnByRef(SnapPreferences::SNAPPOINT_NODE, dxy);
+       m.setup(_desktop, true, _items_const);
+       m.freeSnapReturnByRef(SnapPreferences::SNAPPOINT_NODE, dxy);
 
     } else if (!shift) {
 
@@ -1408,7 +1416,9 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
         ** pick the smallest.
         */
 
-        /* This will be our list of possible translations */
+       m.setup(_desktop, false, _items_const);
+
+       /* This will be our list of possible translations */
         std::list<Inkscape::SnappedPoint> s;
 
         if (control) {