summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-08-27 09:04:37 +0000
committerKrzysztof Kosinski <tweenk.pl@gmail.com>2011-08-27 09:04:37 +0000
commit72cc39b9f0b340548f395c7f61ca9662b34aea09 (patch)
tree34a0853cff6c6040bc2a0572dfa365280fce2601 /src/object-snapper.cpp
parentFix "snap guides" toggle (diff)
downloadinkscape-72cc39b9f0b340548f395c7f61ca9662b34aea09.tar.gz
inkscape-72cc39b9f0b340548f395c7f61ca9662b34aea09.zip
Refactor SPItem bounding box methods: remove NRRect usage and make code
using them more obvious. Fix filter region computation. (bzr r10582.1.1)
Diffstat (limited to 'src/object-snapper.cpp')
-rw-r--r--src/object-snapper.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index fd8ef0c7c..07d690ce0 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -135,15 +135,14 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent,
if (SP_IS_GROUP(o)) {
_findCandidates(o, it, false, bbox_to_snap, clip_or_mask, additional_affine);
} else {
- Geom::OptRect bbox_of_item = Geom::Rect();
+ Geom::OptRect bbox_of_item;
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)
- item->invoke_bbox(bbox_of_item,
- item->i2doc_affine() * additional_affine * _snapmanager->getDesktop()->doc2dt(),
- true);
+ bbox_of_item = item->visualBounds(item->i2doc_affine() * additional_affine *
+ _snapmanager->getDesktop()->doc2dt());
} else {
- item->invoke_bbox( bbox_of_item, item->i2dt_affine(), true);
+ bbox_of_item = item->desktopVisualBounds();
}
if (bbox_of_item) {
// See if the item is within range
@@ -188,7 +187,7 @@ void Inkscape::ObjectSnapper::_collectNodes(SnapSourceType const &t,
Preferences *prefs = Preferences::get();
bool prefs_bbox = prefs->getBool("/tools/bounding_box");
bbox_type = !prefs_bbox ?
- SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
+ SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX;
}
// Consider the page border for snapping to
@@ -255,7 +254,7 @@ void Inkscape::ObjectSnapper::_collectNodes(SnapSourceType const &t,
// Discard the bbox of a clipped path / mask, because we don't want to snap to both the bbox
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
- Geom::OptRect b = root_item->getBboxDesktop(bbox_type);
+ Geom::OptRect b = root_item->desktopBounds(bbox_type);
getBBoxPoints(b, _points_to_snap_to, true,
_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_BBOX_CORNER),
_snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_BBOX_EDGE_MIDPOINT),
@@ -370,7 +369,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/,
Preferences *prefs = Preferences::get();
int prefs_bbox = prefs->getBool("/tools/bounding_box", 0);
bbox_type = !prefs_bbox ?
- SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
+ SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX;
}
// Consider the page border for snapping
@@ -449,11 +448,10 @@ void Inkscape::ObjectSnapper::_collectPaths(Geom::Point /*p*/,
// Discard the bbox of a clipped path / mask, because we don't want to snap to both the bbox
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
- Geom::OptRect rect;
- root_item->invoke_bbox( rect, i2doc, TRUE, bbox_type);
+ Geom::OptRect rect = root_item->bounds(bbox_type, i2doc);
if (rect) {
Geom::PathVector *path = _getPathvFromRect(*rect);
- rect = root_item->getBboxDesktop(bbox_type);
+ rect = root_item->desktopBounds(bbox_type);
_paths_to_snap_to->push_back(SnapCandidatePath(path, SNAPTARGET_BBOX_EDGE, rect));
}
}