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

void SnapManager::constrainedSnapReturnByRef ( Geom::Point p,
Inkscape::SnapSourceType const   source_type,
Inkscape::Snapper::ConstraintLine const &  constraint,
Geom::OptRect const &  bbox_to_snap = Geom::OptRect() 
) const

Try to snap a point along a constraint line to grids, guides or objects.

Try to snap a point to grids, guides or objects, in only one degree-of-freedom, i.e. snap in a specific direction on the two dimensional canvas to the nearest snap target.

constrainedSnapReturnByRef() is equal in snapping behavior to constrainedSnap(), but the former returns the snapped point trough the referenced parameter p. This parameter p initially contains the position of the snap source and will we overwritten by the target position if snapping has occurred. This makes snapping transparent to the calling code. If this is not desired because either the calling code must know whether snapping has occurred, or because the original position should not be touched, then constrainedSnap() should be called instead.

PS: 1) SnapManager::setup() must have been called before calling this method, but only once for a set of points 2) Only to be used when a single source point is to be snapped; it assumes that source_num = 0, which is inefficient when snapping sets our source points

Parameters:
pCurrent position of the snap source; will be overwritten by the position of the snap target if snapping has occurred
source_typeDetailed description of the source type, will be used by the snap indicator
constraintThe direction or line along which snapping must occur
bbox_to_snapBounding box hulling the set of points, all from the same selection and having the same transformation

Definition at line 336 of file snap.cpp.

References constrainedSnap().

{
    Inkscape::SnappedPoint const s = constrainedSnap(Inkscape::SnapCandidatePoint(p, source_type, 0), constraint, bbox_to_snap);
    s.getPoint(p);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index