Code

Selector tool shouldn't snap to path nodes, see Bulia's comment in bug #1589436
authordvlierop2 <dvlierop2@users.sourceforge.net>
Mon, 26 Mar 2007 22:29:17 +0000 (22:29 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Mon, 26 Mar 2007 22:29:17 +0000 (22:29 +0000)
src/selection.cpp
src/selection.h
src/sp-item-group.cpp
src/sp-shape.cpp

index 201661eecc89345575aede6f4195c8ce66ef1efb..05bd8d030283fd1d94d40fb2dfe46e8ba933fcba 100644 (file)
@@ -27,6 +27,7 @@
 #include "xml/repr.h"
 
 #include "sp-shape.h"
+#include "sp-path.h"
 
 #include <sigc++/functors/mem_fun.h>
 
@@ -367,12 +368,20 @@ NR::Maybe<NR::Point> Selection::center() const {
 
 /**
  * Compute the list of points in the selection that are to be considered for snapping.
+ * This includes all special points of each item in the selection, except path nodes
  */
 std::vector<NR::Point> Selection::getSnapPoints() const {
     GSList const *items = const_cast<Selection *>(this)->itemList();
     std::vector<NR::Point> p;
     for (GSList const *iter = items; iter != NULL; iter = iter->next) {
-        sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p));
+        // getSnapPoints() is only being used in the selector tool, which should
+        // not snap path nodes. Only the node tool should snap those.
+        SPItem *this_item = SP_ITEM(iter->data);
+        if (!SP_IS_PATH(this_item)) {
+            // Only snap if we don't have a path at hand
+            // (Same check occurs in sp-item-group)
+            sp_item_snappoints(this_item, SnapPointsIter(p));
+        }
     }
 
     return p;
index f9368f5eef5e5898e72460f2abf218057b84151e..34de82c7ce7df69d7c3dbe0776edb73df2d3580b 100644 (file)
@@ -71,7 +71,7 @@ public:
     ~Selection();
 
     /**
-     * @brief Returns the desktop the seoection is bound to
+     * @brief Returns the desktop the selection is bound to
      *
      * @return the desktop the selection is bound to
      */
index d4fa9536d4cf246c7ea31e970330896a3d4dc414..f43f4ded952fd4c9f0be6a3a41969fa5a98f5b10 100644 (file)
@@ -34,6 +34,7 @@
 #include "prefs-utils.h"
 #include "sp-clippath.h"
 #include "sp-mask.h"
+#include "sp-path.h"
 
 static void sp_group_class_init (SPGroupClass *klass);
 static void sp_group_init (SPGroup *group);
@@ -297,8 +298,10 @@ static void sp_group_snappoints (SPItem const *item, SnapPointsIter p)
             o != NULL;
             o = SP_OBJECT_NEXT(o))
        {
-               if (SP_IS_ITEM(o)) {
-                       sp_item_snappoints(SP_ITEM(o), p);
+               if (SP_IS_ITEM(o) && !SP_IS_PATH(o)) {
+            // getSnapPoints() and sp_group_snappoints are only being used in the selector tool,
+            // which should not snap path nodes. Only the node tool should snap those.
+            sp_item_snappoints(SP_ITEM(o), p);
                }
        }
 }
index cfeee3a29be1b33ad30073cc7c3d38d058a34317..453de5650fd017971a280a7c1c7ad069e69446cf 100644 (file)
@@ -88,19 +88,19 @@ sp_shape_get_type (void)
 static void
 sp_shape_class_init (SPShapeClass *klass)
 {
-        GObjectClass *gobject_class;
+    GObjectClass *gobject_class;
        SPObjectClass *sp_object_class;
        SPItemClass * item_class;
        SPPathClass * path_class;
 
-        gobject_class = (GObjectClass *) klass;
+    gobject_class = (GObjectClass *) klass;
        sp_object_class = (SPObjectClass *) klass;
        item_class = (SPItemClass *) klass;
        path_class = (SPPathClass *) klass;
 
        parent_class = (SPItemClass *)g_type_class_peek_parent (klass);
 
-        gobject_class->finalize = sp_shape_finalize;
+    gobject_class->finalize = sp_shape_finalize;
 
        sp_object_class->build = sp_shape_build;
        sp_object_class->release = sp_shape_release;
@@ -111,7 +111,7 @@ sp_shape_class_init (SPShapeClass *klass)
        item_class->print = sp_shape_print;
        item_class->show = sp_shape_show;
        item_class->hide = sp_shape_hide;
-        item_class->snappoints = sp_shape_snappoints;
+    item_class->snappoints = sp_shape_snappoints;
 }
 
 /**