diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-10-04 01:31:27 +0000 |
|---|---|---|
| committer | jabiertxof <jabier.arraiza@marker.es> | 2015-10-04 01:31:27 +0000 |
| commit | 6b61296109001d15cd1e2a43c38385b5fdba81c7 (patch) | |
| tree | 3bbe592b4c5dd4ec4570de70df53709def6db9c2 /src/document.cpp | |
| parent | Crash. Fix for Bug #1404934 (Crash when opening files (Glib::ConvertError exc... (diff) | |
| download | inkscape-6b61296109001d15cd1e2a43c38385b5fdba81c7.tar.gz inkscape-6b61296109001d15cd1e2a43c38385b5fdba81c7.zip | |
Add improvements to measure tool:
more responsive
add option to handle only active layer or all
add a option to hide/show first and last segment
add a option to compute only one global sice
(bzr r14393.1.1)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/document.cpp b/src/document.cpp index c64bf3ed5..97113cb25 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 h = 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); + h++; + //limit 0 = no limit + if(h == limit){ + prefs->setDouble("/options/cursortolerance/value", saved_delta); + return items; + } + } } // and now we restore it back |
