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

void SnapManager::guideFreeSnap ( Geom::Point p,
Geom::Point const &  guide_normal,
SPGuideDragType  drag_type 
) const

Try to snap a point of a guide to another guide or to a node.

Try to snap a point of a guide to another guide or to a node in two degrees- of-freedom, i.e. snap in any direction on the two dimensional canvas to the nearest snap target. This method is used when dragging or rotating a guide

PS: SnapManager::setup() must have been called before calling this method,

pCurrent position of the point on the guide that is to be snapped; will be overwritten by the position of the snap target if snapping has occurred
guide_normalVector normal to the guide line

Definition at line 405 of file snap.cpp.

References findBestSnap(), getGridSnappers(), and guide.

    if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) {

    if (!(object.GuidesMightSnap() || snapprefs.getSnapToGuides())) {

    Inkscape::SnapCandidatePoint candidate(p, Inkscape::SNAPSOURCE_GUIDE_ORIGIN);
    if (drag_type == SP_DRAG_ROTATE) {
        candidate = Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_GUIDE);

    // Snap to nodes
    SnappedConstraints sc;
    if (object.GuidesMightSnap()) {
        object.guideFreeSnap(sc, p, guide_normal);

    // Snap to guides & grid lines
    SnapperList snappers = getGridSnappers();
    for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) {
        (*i)->freeSnap(sc, candidate, Geom::OptRect(), NULL, NULL);

    Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false, false);


Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index