diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2009-02-20 21:49:07 +0000 |
|---|---|---|
| committer | dvlierop2 <dvlierop2@users.sourceforge.net> | 2009-02-20 21:49:07 +0000 |
| commit | 7860d701fd23d8e5f03086c249d30759732f07fd (patch) | |
| tree | c3b8f351366407783eb5c96ba4fcdbbc7a132da9 /src/selection.cpp | |
| parent | Some filters and extensions updates (diff) | |
| download | inkscape-7860d701fd23d8e5f03086c249d30759732f07fd.tar.gz inkscape-7860d701fd23d8e5f03086c249d30759732f07fd.zip | |
The snap indicator's tooltip now displays "A to B", whereas before it only displayed "B".
(bzr r7335)
Diffstat (limited to 'src/selection.cpp')
| -rw-r--r-- | src/selection.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/selection.cpp b/src/selection.cpp index ea1c0053f..4d92a18df 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -441,48 +441,48 @@ boost::optional<Geom::Point> Selection::center() const { /** * Compute the list of points in the selection that are to be considered for snapping. */ -std::vector<Geom::Point> Selection::getSnapPoints(SnapPreferences const *snapprefs) const { +std::vector<std::pair<Geom::Point, int> > Selection::getSnapPoints(SnapPreferences const *snapprefs) const { GSList const *items = const_cast<Selection *>(this)->itemList(); - + SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs snapprefs_dummy.setIncludeItemCenter(false); // locally disable snapping to the item center - - std::vector<Geom::Point> p; + + std::vector<std::pair<Geom::Point, int> > p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { SPItem *this_item = SP_ITEM(iter->data); - sp_item_snappoints(this_item, SnapPointsIter(p), &snapprefs_dummy); - + sp_item_snappoints(this_item, false, p, &snapprefs_dummy); + //Include the transformation origin for snapping //For a selection or group only the overall origin is considered if (snapprefs != NULL && snapprefs->getIncludeItemCenter()) { - p.push_back(this_item->getCenter()); - } + p.push_back(std::make_pair(this_item->getCenter(), SNAPSOURCE_ROTATION_CENTER)); + } } return p; } -std::vector<Geom::Point> Selection::getSnapPointsConvexHull(SnapPreferences const *snapprefs) const { +std::vector<std::pair<Geom::Point, int> > Selection::getSnapPointsConvexHull(SnapPreferences const *snapprefs) const { GSList const *items = const_cast<Selection *>(this)->itemList(); - std::vector<Geom::Point> p; + std::vector<std::pair<Geom::Point, int> > p; for (GSList const *iter = items; iter != NULL; iter = iter->next) { - sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p), snapprefs); + sp_item_snappoints(SP_ITEM(iter->data), false, p, snapprefs); } - std::vector<Geom::Point> pHull; + std::vector<std::pair<Geom::Point, int> > pHull; if (!p.empty()) { - std::vector<Geom::Point>::iterator i; - Geom::RectHull cvh(p.front()); + std::vector<std::pair<Geom::Point, int> >::iterator i; + Geom::RectHull cvh((p.front()).first); for (i = p.begin(); i != p.end(); i++) { // these are the points we get back - cvh.add(*i); + cvh.add((*i).first); } Geom::OptRect rHull = cvh.bounds(); if (rHull) { for ( unsigned i = 0 ; i < 4 ; ++i ) { - pHull.push_back(rHull->corner(i)); + pHull.push_back(std::make_pair(rHull->corner(i), SNAPSOURCE_CONVEX_HULL_CORNER)); } } } |
