summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0ef926a)
raw | patch | inline | side by side (parent: 0ef926a)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 4 Aug 2007 09:10:17 +0000 (09:10 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 4 Aug 2007 09:10:17 +0000 (09:10 +0000) |
src/selection.cpp | patch | blob | history | |
src/selection.h | patch | blob | history | |
src/seltrans.cpp | patch | blob | history | |
src/snap.cpp | patch | blob | history | |
src/snap.h | patch | blob | history |
diff --git a/src/selection.cpp b/src/selection.cpp
index 2b143dd5a3f379c707be65604113fd2c2d84ed92..ca3de5927e7c41705de52a7df30b384719cabc5f 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
* 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) {
}
//Include the transformation origin for snapping
//For a group only the group's origin is considered
- p.push_back(this_item->getCenter());
+ if (includeItemCenter) {
+ p.push_back(this_item->getCenter());
+ }
}
return p;
diff --git a/src/selection.h b/src/selection.h
index d8427108f344eece726a6846e5e5b66f2ded30ed..58204160b7de9e1972728912f3f4e27c7a4670bc 100644 (file)
--- a/src/selection.h
+++ b/src/selection.h
* @brief Gets the selection's snap points.
* @return Selection's snap points
*/
- std::vector<NR::Point> getSnapPoints() const;
+ std::vector<NR::Point> getSnapPoints(bool includeItemCenter) const;
/**
* @brief Gets the snap points of a selection that form a convex hull.
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 465813ae0b68834f6704e25f95918d71ce70e587..ad37e24cf9b3ab5eda2c500fddff5432d9171fea 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -268,7 +268,8 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho
// Next, get all special points for snapping
- _snap_points = selection->getSnapPoints(); // Excludes path nodes
+ SnapManager const &m = _desktop->namedview->snap_manager;
+ _snap_points = selection->getSnapPoints(m.getIncludeItemCenter()); // Excludes path nodes
std::vector<NR::Point> snap_points_hull = selection->getSnapPointsConvexHull(); // Includes path nodes
if (_snap_points.size() > 100) {
/* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes
diff --git a/src/snap.cpp b/src/snap.cpp
index 3ef246447f3a317b4d5e9b5c45cbd10b85537dbe..f5c1c9589811f95bf88c4bc890afebcf4c9cd70c 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
SnapManager::SnapManager(SPNamedView const *v) :
guide(v, 0),
object(v, 0),
- _named_view(v)
+ _named_view(v),
+ _include_item_center(false)
{
}
diff --git a/src/snap.h b/src/snap.h
index 401fd60bad1eeafa2ebd0484348b75bdae054821..c60d866ad34d0bce75a65f667c961f605b82e9c6 100644 (file)
--- a/src/snap.h
+++ b/src/snap.h
bool getSnapModeBBox() const;
bool getSnapModeNode() const;
+ void setIncludeItemCenter(bool enabled) {
+ _include_item_center = enabled;
+ }
+
+ bool getIncludeItemCenter() const {
+ return _include_item_center;
+ }
+
protected:
SPNamedView const *_named_view;
SKEW
};
+ bool _include_item_center; //If true, snapping nodes will also snap the item's center
+
std::pair<NR::Point, bool> _snapTransformed(Inkscape::Snapper::PointType type,
std::vector<NR::Point> const &points,
std::list<SPItem const *> const &ignore,