From 3b585aa639d46417beb401847600e5918406e5c1 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 18 Oct 2014 17:03:29 +0200 Subject: LPE Powerstroke, editing behavior: implement scaling of strokepath width when the proportional-stroke-scaling toggle is on. Patch by Javier, tweaks by Johan. (bzr r13623) --- src/live_effects/parameter/powerstrokepointarray.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/live_effects/parameter/powerstrokepointarray.cpp') diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index 647986da6..420195aa8 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -68,9 +68,23 @@ PowerStrokePointArrayParam::param_newWidget() } -void PowerStrokePointArrayParam::param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/) +void PowerStrokePointArrayParam::param_transform_multiply(Geom::Affine const &postmul, bool /*set*/) { -// param_set_and_write_new_value( (*this) * postmul ); + // Check if proportional stroke-width scaling is on + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool transform_stroke = prefs ? prefs->getBool("/options/transform/stroke", true) : true; + if (transform_stroke) { + std::vector result; + result.reserve(_vector.size()); // reserve space for the points that will be added in the for loop + for (std::vector::const_iterator point_it = _vector.begin(), e = _vector.end(); + point_it != e; ++point_it) + { + // scale each width knot with the average scaling in X and Y + Geom::Coord const A = (*point_it)[Geom::Y] * ((postmul.expansionX() + postmul.expansionY()) / 2); + result.push_back(Geom::Point((*point_it)[Geom::X], A)); + } + param_set_and_write_new_value(result); + } } -- cgit v1.2.3