summaryrefslogtreecommitdiffstats
path: root/src/sp-item-transform.cpp
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2014-01-20 22:06:21 +0000
committerapenner <penner@vaxxine.com>2014-01-20 22:06:21 +0000
commit0e330f5f1fc975666d7a934e3d2efe594ac0b876 (patch)
tree26d77ae4df52759d6acc6a2c8e839645af33bf4f /src/sp-item-transform.cpp
parentcppcheck stuff (diff)
downloadinkscape-0e330f5f1fc975666d7a934e3d2efe594ac0b876.tar.gz
inkscape-0e330f5f1fc975666d7a934e3d2efe594ac0b876.zip
1. make scaling of stroke of horizontal line the same as nearly horizontal line. 2. remove vertical offset when using Transform dialog to attempt to vertically scale horizontal line.
(bzr r12964)
Diffstat (limited to 'src/sp-item-transform.cpp')
-rw-r--r--src/sp-item-transform.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp
index 854fb9cd7..7fa591fee 100644
--- a/src/sp-item-transform.cpp
+++ b/src/sp-item-transform.cpp
@@ -144,13 +144,11 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua
gdouble r1 = r0;
if ((fabs(w0 - stroke_x) < 1e-6) || w1 == 0) { // We have a vertical line at hand
- r1 = transform_stroke ? r0 * sqrt(h1/h0) : r0;
- scale_x = 1;
- scale_y = preserve ? h1/h0 : (h1 - r1)/(h0 - r0);
+ scale_y = h1/h0;
+ scale_x = transform_stroke ? 1 : scale_y;
} else if ((fabs(h0 - stroke_y) < 1e-6) || h1 == 0) { // We have a horizontal line at hand
- r1 = transform_stroke ? r0 * sqrt(w1/w0) : r0;
- scale_x = preserve ? w1/w0 : (w1 - r1)/(w0 - r0);
- scale_y = 1;
+ scale_x = w1/w0;
+ scale_y = transform_stroke ? 1 : scale_x;
} else { // We have a true 2D object at hand
if (transform_stroke && !preserve) {
/* Initial area of the geometric bounding box: A0 = (w0-r0)*(h0-r0)
@@ -297,13 +295,13 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu
gdouble r1w = r0w;
if ((fabs(w0 - r0w) < 1e-6) || w1 == 0) { // We have a vertical line at hand
- r1h = transform_stroke ? r0h * sqrt(h1/h0) : r0h;
- scale_x = 1;
- scale_y = preserve ? h1/h0 : (h1 - r1h)/(h0 - r0h);
+ scale_y = h1/h0;
+ scale_x = transform_stroke ? 1 : scale_y;
+ unbudge *= Geom::Translate (flip_x * 0.5 * (w1 - w0), 0); // compensate for the fact that this operation cannot be performed
} else if ((fabs(h0 - r0h) < 1e-6) || h1 == 0) { // We have a horizontal line at hand
- r1w = transform_stroke ? r0w * sqrt(w1/w0) : r0w;
- scale_x = preserve ? w1/w0 : (w1 - r1w)/(w0 - r0w);
- scale_y = 1;
+ scale_x = w1/w0;
+ scale_y = transform_stroke ? 1 : scale_x;
+ unbudge *= Geom::Translate (0, flip_y * 0.5 * (h1 - h0)); // compensate for the fact that this operation cannot be performed
} else { // We have a true 2D object at hand
if (transform_stroke && !preserve) {
/* Initial area of the geometric bounding box: A0 = (w0-r0w)*(h0-r0h)