Code

Changed preference to use file chooser button
[inkscape.git] / src / selection.cpp
index 44f601362e1494eedce9c43b9a8381d5e3be7391..af5db825c0c19efc905bfef8a4559a298fa10da9 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "sp-shape.h"
 #include "sp-path.h"
+#include "sp-item-group.h"
 
 #include <sigc++/functors/mem_fun.h>
 
@@ -370,7 +371,7 @@ 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 {
+std::vector<NR::Point> Selection::getSnapPoints(bool includeItemCenter) const {
     GSList const *items = const_cast<Selection *>(this)->itemList();
     std::vector<NR::Point> p;
     for (GSList const *iter = items; iter != NULL; iter = iter->next) {
@@ -380,8 +381,13 @@ std::vector<NR::Point> Selection::getSnapPoints() const {
         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));
+            sp_item_snappoints(this_item, false, SnapPointsIter(p));
         }
+        //Include the transformation origin for snapping
+        //For a group only the group's origin is considered
+        if (includeItemCenter) {
+               p.push_back(this_item->getCenter());
+        }  
     }
 
     return p;
@@ -392,7 +398,7 @@ std::vector<NR::Point> Selection::getSnapPointsConvexHull() const {
 
     std::vector<NR::Point> p;
     for (GSList const *iter = items; iter != NULL; iter = iter->next) {
-       sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p));
+               sp_item_snappoints(SP_ITEM(iter->data), false, SnapPointsIter(p));
     }
 
     std::vector<NR::Point> pHull;