summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/object-snapper.cpp')
-rw-r--r--src/object-snapper.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index c03a7c288..35841891f 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -238,11 +238,7 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::SnapPreferences::PointType
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
Geom::OptRect b = sp_item_bbox_desktop(root_item, bbox_type);
- if (b) {
- for ( unsigned k = 0 ; k < 4 ; k++ ) {
- _points_to_snap_to->push_back(b->corner(k));
- }
- }
+ getBBoxPoints(b, _points_to_snap_to, _snapmanager->snapprefs.getSnapMidpoints());
}
}
}
@@ -736,6 +732,20 @@ void Inkscape::ObjectSnapper::_getBorderNodes(std::vector<Geom::Point> *points)
points->push_back(Geom::Point(w,0));
}
+void Inkscape::getBBoxPoints(Geom::OptRect const bbox, std::vector<Geom::Point> *points, bool const includeMidpoints)
+{
+ if (bbox) {
+ // collect the corners of the bounding box
+ for ( unsigned k = 0 ; k < 4 ; k++ ) {
+ points->push_back(bbox->corner(k));
+ // optionally, collect the midpoints of the bounding box's edges too
+ if (includeMidpoints) {
+ points->push_back((bbox->corner(k) + bbox->corner((k+1) % 4))/2);
+ }
+ }
+ }
+}
+
/*
Local Variables:
mode:c++