summaryrefslogtreecommitdiffstats
path: root/src/seltrans.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-04-18 19:43:05 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-04-18 19:43:05 +0000
commit36eb7fb624e3a134c8cad002cc3906509cd2888b (patch)
treef063cb9d71818d6feed83a1b3656e707d28ec67b /src/seltrans.cpp
parentFix for bug #455302 and bug #165529, also partially fixes bounding box of var... (diff)
downloadinkscape-36eb7fb624e3a134c8cad002cc3906509cd2888b.tar.gz
inkscape-36eb7fb624e3a134c8cad002cc3906509cd2888b.zip
Fix bbox snapping as reported in LP bug #562205
Fixed bugs: - https://launchpad.net/bugs/562205 (bzr r9351)
Diffstat (limited to 'src/seltrans.cpp')
-rw-r--r--src/seltrans.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 7a08e0a7e..aef608420 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -999,8 +999,6 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state)
m.setup(_desktop, false, _items_const);
Inkscape::SnappedPoint bb, sn;
- Geom::Coord bd(NR_HUGE);
- Geom::Coord sd(NR_HUGE);
if ((state & GDK_CONTROL_MASK) || _desktop->isToolboxButtonActive ("lock")) {
// Scale is locked to a 1:1 aspect ratio, so that s[X] must be made to equal s[Y].
@@ -1017,27 +1015,17 @@ gboolean Inkscape::SelTrans::scaleRequest(Geom::Point &pt, guint state)
// Snap along a suitable constraint vector from the origin.
bb = m.constrainedSnapScale(_bbox_points, _point, default_scale, _origin_for_bboxpoints);
sn = m.constrainedSnapScale(_snap_points, _point, geom_scale, _origin_for_specpoints);
-
- /* Choose the smaller difference in scale. Since s[X] == s[Y] we can
- ** just compare difference in s[X].
- */
- bd = bb.getSnapped() ? fabs(bb.getTransformation()[Geom::X] - default_scale[Geom::X]) : NR_HUGE;
- sd = sn.getSnapped() ? fabs(sn.getTransformation()[Geom::X] - geom_scale[Geom::X]) : NR_HUGE;
} else {
/* Scale aspect ratio is unlocked */
bb = m.freeSnapScale(_bbox_points, _point, default_scale, _origin_for_bboxpoints);
sn = m.freeSnapScale(_snap_points, _point, geom_scale, _origin_for_specpoints);
-
- /* Pick the snap that puts us closest to the original scale */
- bd = bb.getSnapped() ? fabs(Geom::L2(bb.getTransformation()) - Geom::L2(Geom::Point(default_scale[Geom::X], default_scale[Geom::Y]))) : NR_HUGE;
- sd = sn.getSnapped() ? fabs(Geom::L2(sn.getTransformation()) - Geom::L2(Geom::Point(geom_scale[Geom::X], geom_scale[Geom::Y]))) : NR_HUGE;
}
if (!(bb.getSnapped() || sn.getSnapped())) {
// We didn't snap at all! Don't update the handle position, just calculate the new transformation
_calcAbsAffineDefault(default_scale);
_desktop->snapindicator->remove_snaptarget();
- } else if (bd < sd) {
+ } else if (bb.getSnapped() && !bb.isOtherSnapBetter(sn, false)) {
// We snapped the bbox (which is either visual or geometric)
_desktop->snapindicator->set_new_snaptarget(bb);
default_scale = Geom::Scale(bb.getTransformation());
@@ -1109,8 +1097,6 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom
Inkscape::SnappedPoint bb, sn;
g_assert(bb.getSnapped() == false); // Check initialization to catch any regression
- Geom::Coord bd(NR_HUGE);
- Geom::Coord sd(NR_HUGE);
bool symmetrical = state & GDK_CONTROL_MASK;
@@ -1119,12 +1105,10 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom
if (bb.getSnapped()) {
// We snapped the bbox (which is either visual or geometric)
- bd = fabs(bb.getTransformation()[axis] - default_scale[axis]);
default_scale[axis] = bb.getTransformation()[axis];
}
if (sn.getSnapped()) {
- sd = fabs(sn.getTransformation()[axis] - geom_scale[axis]);
geom_scale[axis] = sn.getTransformation()[axis];
}
@@ -1139,7 +1123,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, Geom
// We didn't snap at all! Don't update the handle position, just calculate the new transformation
_calcAbsAffineDefault(default_scale);
_desktop->snapindicator->remove_snaptarget();
- } else if (bd < sd) {
+ } else if (bb.getSnapped() && !bb.isOtherSnapBetter(sn, false)) {
_desktop->snapindicator->set_new_snaptarget(bb);
// Calculate the new transformation and update the handle position
pt = _calcAbsAffineDefault(default_scale);