summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-11-08 22:51:43 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-11-08 22:51:43 +0000
commit16617cc3f8e4692b2f76e99347a82eb7572bdefa (patch)
tree9c97fa99dc5eb5a0255ea03721f413d55d4bfcf4 /src/document.cpp
parentworking on roughen (diff)
parentmerge of branch lp:~inkscape.dev/inkscape/spraytool-no-overlap (diff)
downloadinkscape-16617cc3f8e4692b2f76e99347a82eb7572bdefa.tar.gz
inkscape-16617cc3f8e4692b2f76e99347a82eb7572bdefa.zip
update to trunk
(bzr r14422.3.3)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/document.cpp b/src/document.cpp
index c64bf3ed5..0e49f23e2 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1450,7 +1450,7 @@ std::vector<SPItem*> SPDocument::getItemsPartiallyInBox(unsigned int dkey, Geom:
return find_items_in_area(x, SP_GROUP(this->root), dkey, box, overlaps);
}
-std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points) const
+std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers, size_t limit) const
{
std::vector<SPItem*> items;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -1464,11 +1464,25 @@ std::vector<SPItem*> SPDocument::getItemsAtPoints(unsigned const key, std::vecto
// Cache a flattened SVG DOM to speed up selection.
std::deque<SPItem*> nodes;
build_flat_item_list(&nodes, key, SP_GROUP(this->root), true, false, NULL);
-
+ SPObject *current_layer = SP_ACTIVE_DESKTOP->currentLayer();
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ Inkscape::LayerModel *layer_model = NULL;
+ if(desktop){
+ layer_model = desktop->layers;
+ }
+ size_t item_counter = 0;
for(int i = points.size()-1;i>=0; i--) {
SPItem *item = find_item_at_point(&nodes, key, points[i]);
if (item && items.end()==find(items.begin(),items.end(), item))
- items.push_back(item);
+ if(all_layers || (layer_model && layer_model->layerForObject(item) == current_layer)){
+ items.push_back(item);
+ item_counter++;
+ //limit 0 = no limit
+ if(item_counter == limit){
+ prefs->setDouble("/options/cursortolerance/value", saved_delta);
+ return items;
+ }
+ }
}
// and now we restore it back