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

void SnapManager::freeSnapReturnByRef ( Inkscape::SnapPreferences::PointType  point_type,
Geom::Point p,
Inkscape::SnapSourceType const   source_type,
bool  first_point = true,
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. freeSnapReturnByRef() is equal in snapping behavior to freeSnap(), 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 freeSnap() should be called instead.

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

point_type Category of points to which the source point belongs: node, guide or bounding box
p Current position of the snap source; will be overwritten by the position of the snap target if snapping has occurred
source_type Detailed description of the source type, will be used by the snap indicator
first_point If true then this point is the first one from a set of points, all from the same selection and having the same transformation
bbox_to_snap Bounding box hulling the set of points, all from the same selection and having the same transformation

Definition at line 171 of file snap.cpp.

References freeSnap(), and Inkscape::SnappedPoint::getPoint().

Referenced by pen_handle_button_press().

    //TODO: PointType and source_type are somewhat redundant; can't we get rid of the point_type parameter?
    Inkscape::SnappedPoint const s = freeSnap(point_type, p, source_type, first_point, bbox_to_snap);

Generated by  Doxygen 1.6.0   Back to index