summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c235f3)
raw | patch | inline | side by side (parent: 2c235f3)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 31 Mar 2007 12:01:58 +0000 (12:01 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Sat, 31 Mar 2007 12:01:58 +0000 (12:01 +0000) |
src/geom.cpp | patch | blob | history | |
src/seltrans.cpp | patch | blob | history |
diff --git a/src/geom.cpp b/src/geom.cpp
index bc161bf9fc74b10fa70547fe0a4d26e4b148481c..e59b0f30233ae211b981c5986b3b98d2503c5c97 100644 (file)
--- a/src/geom.cpp
+++ b/src/geom.cpp
*
* This function finds the intersection of the two lines (infinite)
* defined by n0.X = d0 and x1.X = d1. The algorithm is as follows:
- * To compute the intersection point use kramer's rule:
+ * To compute the intersection point use Cramer's rule:
+ * (see http://en.wikipedia.org/wiki/Cramer%27s_rule)
* \verbatim
* convert lines to form
* ax + by = c
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 5ace790ecf8a4c46e0ec6de66b6b0de2f928dbfa..f62e18ac2cbd547af4b73dfc0a33eed51463765b 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
}
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].
- ** To do this, we snap along a suitable constraint vector from the origin.
- */
-
+ // Scale is locked to a 1:1 aspect ratio, so that s[X] must be made to equal s[Y].
+ //
+ // The aspect-ratio must be locked before snapping
+ if (fabs(s[NR::X]) > fabs(s[NR::Y])) {
+ s[NR::X] = fabs(s[NR::Y]) * sign(s[NR::X]);
+ } else {
+ s[NR::Y] = fabs(s[NR::X]) * sign(s[NR::Y]);
+ }
+
+ // Snap along a suitable constraint vector from the origin.
+
// The inclination of the constraint vector is calculated from the aspect ratio
NR::Point bbox_dim = _box->dimensions();
double const aspect_ratio = bbox_dim[1] / bbox_dim[0]; // = height / width
_origin_for_snappoints);
if (bb.second == false && sn.second == false) {
-
- /* We didn't snap, so just lock aspect ratio */
- if (fabs(s[NR::X]) > fabs(s[NR::Y])) {
- s[NR::X] = fabs(s[NR::Y]) * sign(s[NR::X]);
- } else {
- s[NR::Y] = fabs(s[NR::X]) * sign(s[NR::Y]);
- }
-
+ /* We didn't snap, so just keep the locked aspect ratio */
} else {
-
/* Choose the smaller difference in scale. Since s[X] == s[Y] we can
** just compare difference in s[X].
*/
@@ -993,6 +992,7 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
SnapManager const &m = _desktop->namedview->snap_manager;
if ( state & GDK_CONTROL_MASK ) {
+ // on ctrl, apply symmetrical scaling instead of stretching
s[perp] = fabs(s[axis]);
std::pair<NR::Coord, bool> const bb = m.freeSnapStretch(