From 899143e7e4c7447f089eb436e0f4250864ad276e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 May 2006 15:07:33 +0000 Subject: Remove some old snap code. (bzr r738) --- src/seltrans.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 2d4201fac..70dd0d1a0 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -889,6 +889,8 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR:: it.push_back(reinterpret_cast(i->data)); } + SnapManager const &m = _desktop->namedview->snap_manager; + if ( state & GDK_CONTROL_MASK ) { s[perp] = fabs(s[axis]); @@ -906,17 +908,27 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR:: s[axis] = fabs(ratio) * sign(s[axis]); s[perp] = fabs(s[axis]); } else { - std::pair bb = namedview_dim_snap_list_scale(_desktop->namedview, Snapper::BBOX_POINT, - _bbox_points, _origin, - s[axis], axis, it); - std::pair sn = namedview_dim_snap_list_scale(_desktop->namedview, Snapper::SNAP_POINT, - _snap_points, _origin, - s[axis], axis, it); - /* Pick the snap that puts us closest to the original scale */ - NR::Coord bd = bb.second ? fabs(bb.first - s[axis]) : NR_HUGE; - NR::Coord sd = sn.second ? fabs(sn.first - s[axis]) : NR_HUGE; - s[axis] = (bd < sd) ? bb.first : sn.first; + std::pair const bb = m.constrainedSnapScale( + Snapper::BBOX_POINT, + _bbox_points, + it, + Inkscape::Snapper::ConstraintLine(component_vectors[axis]), + s, + _origin); + + std::pair const sn = m.constrainedSnapScale( + Snapper::SNAP_POINT, + _snap_points, + it, + Inkscape::Snapper::ConstraintLine(component_vectors[axis]), + s, + _origin); + + /* 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; } pt = ( _point - _origin ) * NR::scale(s) + _origin; -- cgit v1.2.3