summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2011-10-12 21:23:51 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2011-10-12 21:23:51 +0000
commit5feadccf4874e67e126c5133b3ba06b53c01c609 (patch)
tree9c9ceb091ae8afb073444a20b88163014f411ba4 /src/object-snapper.cpp
parentmodify scaling of vertical offset for text placement (Bug 868594) (diff)
downloadinkscape-5feadccf4874e67e126c5133b3ba06b53c01c609.tar.gz
inkscape-5feadccf4874e67e126c5133b3ba06b53c01c609.zip
Object snapper: only use the visual bounding box when absolutely needed; otherwise default to geometric bounding box
(bzr r10675)
Diffstat (limited to 'src/object-snapper.cpp')
-rw-r--r--src/object-snapper.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index b14415c47..68e63a0c1 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -137,13 +137,19 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent,
_findCandidates(o, it, false, bbox_to_snap, clip_or_mask, additional_affine);
} else {
Geom::OptRect bbox_of_item;
+ Preferences *prefs = Preferences::get();
+ int prefs_bbox = prefs->getBool("/tools/bounding_box", 0);
+ // We'll only need to obtain the visual bounding box if the user preferences tell
+ // us to, AND if we are snapping to the bounding box itself. If we're snapping to
+ // paths only, then we can just as well use the geometric bounding box (which is faster)
+ SPItem::BBoxType bbox_type = (!prefs_bbox && _snapmanager->snapprefs.getSnapModeBBox()) ?
+ SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX;
if (clip_or_mask) {
// Oh oh, this will get ugly. We cannot use sp_item_i2d_affine directly because we need to
// insert an additional transformation in document coordinates (code copied from sp_item_i2d_affine)
- bbox_of_item = item->visualBounds(item->i2doc_affine() * additional_affine *
- _snapmanager->getDesktop()->doc2dt());
+ bbox_of_item = item->bounds(bbox_type, item->i2doc_affine() * additional_affine * _snapmanager->getDesktop()->doc2dt());
} else {
- bbox_of_item = item->desktopVisualBounds();
+ bbox_of_item = item->bounds(bbox_type);
}
if (bbox_of_item) {
// See if the item is within range