Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

Inkscape::SnappedPoint SnapManager::freeSnap ( Inkscape::SnapCandidatePoint const &  p,
Geom::OptRect const &  bbox_to_snap = Geom::OptRect() 
) const

Try to snap a point to grids, guides or objects.

Try to snap a point to grids, guides or objects, in two degrees-of-freedom, i.e. snap in any direction on the two dimensional canvas to the nearest snap target. freeSnap() is equal in snapping behavior to freeSnapReturnByRef(). Please read the comments of the latter for more details

PS: SnapManager::setup() must have been called before calling this method, but only once for a set of points

Parameters:
pSource point to be snapped
bbox_to_snapBounding box hulling the set of points, all from the same selection and having the same transformation
Returns:
An instance of the SnappedPoint class, which holds data on the snap source, snap target, and various metrics

Definition at line 200 of file snap.cpp.

References _items_to_ignore, _unselected_nodes, findBestSnap(), getSnappers(), and someSnapperMightSnap().

Referenced by _snapTransformed(), Inkscape::UI::Node::dragged(), and freeSnapReturnByRef().

{
    if (!someSnapperMightSnap()) {
        return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false, false);
    }

    SnappedConstraints sc;
    SnapperList const snappers = getSnappers();

    for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) {
        (*i)->freeSnap(sc, p, bbox_to_snap, &_items_to_ignore, _unselected_nodes);
    }

    return findBestSnap(p, sc, false);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index