From 9dcc516ec5aec5ae5a9da67e25015ad0cafdec4c Mon Sep 17 00:00:00 2001 From: dvlierop2 Date: Sun, 18 May 2008 20:38:43 +0000 Subject: [PATCH] Fix regression in constrained translation --- src/seltrans.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 94baf12d7..bdb0f794a 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1430,19 +1430,21 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state) if (best_snapped_point.getSnapped()) { _desktop->snapindicator->set_new_snappoint(best_snapped_point); } else { - _desktop->snapindicator->remove_snappoint(); + // We didn't snap, so remove any previous snap indicator + _desktop->snapindicator->remove_snappoint(); + if (control) { + // If we didn't snap, then we should still constrain horizontally or vertically + // (When we did snap, then this constraint has already been enforced by + // calling constrainedSnapTranslation() above) + if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) { + dxy[NR::Y] = 0; + } else { + dxy[NR::X] = 0; + } + } } } - - //if (control) { - // /* Ensure that the horizontal and vertical constraint has been applied */ - // if (fabs(dxy[NR::X]) > fabs(dxy[NR::Y])) { - // dxy[NR::Y] = 0; - // } else { - // dxy[NR::X] = 0; - // } - //} - + NR::Matrix const move((NR::translate(dxy))); NR::Point const norm(0, 0); transform(move, norm); -- 2.30.2