summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-04-12 07:22:09 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-04-12 07:22:09 +0000
commita24b5812eb45231a9cf93820ed08ad93798c9aab (patch)
tree1361a81f9b0ba41a844cdbf0da40c1a477055374 /src/document.cpp
parentadd touchpath mode (diff)
downloadinkscape-a24b5812eb45231a9cf93820ed08ad93798c9aab.tar.gz
inkscape-a24b5812eb45231a9cf93820ed08ad93798c9aab.zip
add method to select objects picked by a vector of points
(bzr r2864)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp
index 4dd0f3d21..a61dffc0b 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -996,6 +996,30 @@ GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey
return find_items_in_area(NULL, SP_GROUP(document->root), dkey, box, overlaps);
}
+GSList *
+sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<NR::Point> points)
+{
+ GSList *items = NULL;
+
+ // When picking along the path, we don't want small objects close together
+ // (such as hatching strokes) to obscure each other by their deltas,
+ // so we temporarily set delta to a small value
+ gdouble saved_delta = prefs_get_double_attribute ("options.cursortolerance", "value", 1.0);
+ prefs_set_double_attribute ("options.cursortolerance", "value", 0.25);
+
+ for(unsigned int i = 0; i < points.size(); i++) {
+ SPItem *item = sp_document_item_at_point(document, key, points[i],
+ false, NULL);
+ if (item && !g_slist_find(items, item))
+ items = g_slist_prepend (items, item);
+ }
+
+ // and now we restore it back
+ prefs_set_double_attribute ("options.cursortolerance", "value", saved_delta);
+
+ return items;
+}
+
SPItem *
sp_document_item_at_point(SPDocument *document, unsigned const key, NR::Point const p,
gboolean const into_groups, SPItem *upto)