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

Inkscape::SnappedPoint SnapManager::constrainedSnapSkew ( std::vector< Inkscape::SnapCandidatePoint > const &  p,
Geom::Point const &  pointer,
Inkscape::Snapper::ConstraintLine const &  constraint,
Geom::Point const &  s,
Geom::Point const &  o,
Geom::Dim2  d 
) const

Apply a skew to a set of points and snap such that the direction of the skew is preserved.

Parameters:
point_type Category of points to which the source point belongs: node or bounding box.
p Collection of points to snap (snap sources), at their untransformed position, all points undergoing the same transformation. Paired with an identifier of the type of the snap source.
pointer Location of the mouse pointer at the time dragging started (i.e. when the selection was still untransformed).
constraint The direction or line along which snapping must occur.
s Proposed skew; the final skew can only be calculated after snapping has occurred
o Origin of the proposed skew
d Dimension in which to apply proposed skew.
Returns:
An instance of the SnappedPoint class, which holds data on the snap source, snap target, and various metrics.

Definition at line 868 of file snap.cpp.

References _displaySnapsource(), _snapTransformed(), and _transformPoint().

{
    // "s" contains skew factor in s[0], and scale factor in s[1]

    // Snapping the nodes of the bounding box of a selection that is being transformed, will only work if
    // the transformation of the bounding box is equal to the transformation of the individual nodes. This is
    // NOT the case for example when rotating or skewing. The bounding box itself cannot possibly rotate or skew,
    // so it's corners have a different transformation. The snappers cannot handle this, therefore snapping
    // of bounding boxes is not allowed here.
    if (p.size() > 0) {
        g_assert(!(p.at(0).getSourceType() & Inkscape::SNAPSOURCE_BBOX_CATEGORY));
    }

    if (p.size() == 1) {
        Geom::Point pt = _transformPoint(p.at(0), SKEW, s, o, d, false);
        _displaySnapsource(Inkscape::SnapCandidatePoint(pt, p.at(0).getSourceType()));
    }

    return _snapTransformed(p, pointer, true, constraint, SKEW, s, o, d, false);
}


Generated by  Doxygen 1.6.0   Back to index