From: dvlierop2 Date: Fri, 29 Aug 2008 17:27:26 +0000 (+0000) Subject: Fix regression in snapping to paths (which caused self-snapping) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5f893ca19c15b8cec5043cadac5a79fee52eb7bd;p=inkscape.git Fix regression in snapping to paths (which caused self-snapping) --- 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::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()) {