summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2008-08-29 17:27:26 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2008-08-29 17:27:26 +0000
commitfe8aed00b01191dd3506948184f763940bf5d7a1 (patch)
tree4a9b5bac333e917655dd275bf160a1043a6fcd45 /src/object-snapper.cpp
parentUlf Ericson's patch for implementing missing properties in the new pdf exporter (diff)
downloadinkscape-fe8aed00b01191dd3506948184f763940bf5d7a1.tar.gz
inkscape-fe8aed00b01191dd3506948184f763940bf5d7a1.zip
Fix regression in snapping to paths (which caused self-snapping)
(bzr r6727)
Diffstat (limited to 'src/object-snapper.cpp')
-rw-r--r--src/object-snapper.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 4b6673bd0..a647f022e 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -460,11 +460,11 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc,
std::vector<double>::const_iterator np = anp.begin();
unsigned int index = 0;
for (; np != anp.end(); np++, index++) {
- bool c1 = true;
- bool c2 = true;
- Geom::Point start_pt = desktop->doc2dt((*it_pv).pointAt(floor(*np)));
- Geom::Point end_pt = desktop->doc2dt((*it_pv).pointAt(ceil(*np)));
-
+ Geom::Curve const *curve = &((*it_pv).at_index(index));
+ Geom::Point const sp_doc = curve->pointAt(*np);
+
+ bool c1 = true;
+ bool c2 = true;
if (being_edited) {
/* If the path is being edited, then we should only snap though to stationary pieces of the path
* and not to the pieces that are being dragged around. This way we avoid
@@ -472,14 +472,13 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc,
* piece are unselected; if they are then this piece must be stationary
*/
g_assert(unselected_nodes != NULL);
+ Geom::Point start_pt = desktop->doc2dt(curve->pointAt(0));
+ Geom::Point end_pt = desktop->doc2dt(curve->pointAt(1));
c1 = isUnselectedNode(start_pt, unselected_nodes);
c2 = isUnselectedNode(end_pt, unselected_nodes);
}
- Geom::Curve const *curve = &((*it_pv).at_index(index));
- Geom::Point const sp_doc = curve->pointAt(*np);
- Geom::Point const sp_dt = desktop->doc2dt(sp_doc);
-
+ Geom::Point const sp_dt = desktop->doc2dt(sp_doc);
if (!being_edited || (c1 && c2)) {
Geom::Coord const dist = Geom::distance(sp_doc, p_doc);
if (dist < getSnapperTolerance()) {