diff options
| author | Carl Hetherington <cth@carlh.net> | 2006-05-05 16:44:29 +0000 |
|---|---|---|
| committer | cth103 <cth103@users.sourceforge.net> | 2006-05-05 16:44:29 +0000 |
| commit | 1241b0a2a63239470a6d06203aa0e5aae4678cf9 (patch) | |
| tree | 008cba351e63f30d68704cb2497046edaeebcc65 /src/seltrans.cpp | |
| parent | fix 1482463 (diff) | |
| download | inkscape-1241b0a2a63239470a6d06203aa0e5aae4678cf9.tar.gz inkscape-1241b0a2a63239470a6d06203aa0e5aae4678cf9.zip | |
More snapping cleanups.
(bzr r741)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 70dd0d1a0..2eeafd8d2 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -894,41 +894,55 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR:: if ( state & GDK_CONTROL_MASK ) { s[perp] = fabs(s[axis]); - std::pair<double, bool> sn = namedview_vector_snap_list(_desktop->namedview, - Snapper::BBOX_POINT, - _bbox_points, _origin, s, it); - std::pair<double, bool> bb = namedview_vector_snap_list(_desktop->namedview, - Snapper::SNAP_POINT, - _snap_points, _origin, s, it); + std::pair<NR::Coord, bool> const bb = m.freeSnapStretch( + Snapper::BBOX_POINT, + _bbox_points, + it, + s[axis], + _origin, + axis, + true); + + std::pair<NR::Coord, bool> const sn = m.freeSnapStretch( + Snapper::SNAP_POINT, + _snap_points, + it, + s[axis], + _origin, + axis, + true); - double bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE; - double sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE; - double ratio = (bd < sd) ? bb.first : sn.first; + NR::Coord const bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE; + NR::Coord const sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE; + NR::Coord const ratio = (bd < sd) ? bb.first : sn.first; s[axis] = fabs(ratio) * sign(s[axis]); s[perp] = fabs(s[axis]); } else { - std::pair<NR::scale, bool> const bb = m.constrainedSnapScale( + std::pair<NR::Coord, bool> const bb = m.freeSnapStretch( Snapper::BBOX_POINT, _bbox_points, it, - Inkscape::Snapper::ConstraintLine(component_vectors[axis]), - s, - _origin); + s[axis], + _origin, + axis, + false); - std::pair<NR::scale, bool> const sn = m.constrainedSnapScale( + std::pair<NR::Coord, bool> const sn = m.freeSnapStretch( Snapper::SNAP_POINT, _snap_points, it, - Inkscape::Snapper::ConstraintLine(component_vectors[axis]), - s, - _origin); + s[axis], + _origin, + axis, + false); /* Choose the smaller difference in scale */ - NR::Coord const bd = bb.second ? fabs(bb.first[axis] - s[axis]) : NR_HUGE; - NR::Coord const sd = sn.second ? fabs(sn.first[axis] - s[axis]) : NR_HUGE; - s = (bd < sd) ? bb.first : sn.first; + NR::Coord const bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE; + NR::Coord const sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE; + s[axis] = (bd < sd) ? bb.first : sn.first; + s[perp] = 1; } pt = ( _point - _origin ) * NR::scale(s) + _origin; |
