0

My document contains two rectangles. It works as expected to scale the width for instance, i.e. all stroke widths are equal. Even if I have selected both objects.

But if these objects are grouped together and I scale the width of that group, things go crazy and the width of the strokes are not equal anymore:
unequal stroke widths after scaling

Any ideas? Is that intended behaviour? I am using Inkscape v1.0.2 (e86c870879, 2021-01-15)

I looked into the XML code, but that looks sane at a first glance, but I am inexperienced with that kind of stuff.

Btw, the behaviour is unrelated to the Transforms | Scale stroke width preference. Furthermore it also happens if the preference Transforms | Store transformation is set to Optimized.

3

2 Answers 2

2

That's because Inkscape changes the actual parameters (like the width and height attributes of a rectangle) of objects directly when changed separately, but simply just adds a transform attribute to groups. Changing the scale with transform stretches/distorts the objects visually, including the stroke.

When the option 'Store transformation' in the preferences under 'Behaviour → Transforms' is set to 'Optimized', simply ungrouping then regrouping should, in most cases, apply the transform to each object and fix the stroke. Alternatively try this extension to recursively apply transform attributes.

1

Just to add to what user @Xrott has already said (which is the correct answer BTW) . . .

In terms of the SVG, you can see what's going on here, and how a transform is applied to a group, but not when the objects are ungrouped. All I did to achieve this here was simply to ungroup to apply the transform.

  <g transform="matrix(1,0,0,4.93,0,-130)" stroke-width=".689">
   <rect x="17.5" y="42.7" width="24.3" height="11.5" ry=".17" opacity=".55"/>
   <rect x="48.5" y="33.2" width="30.7" height="14.6" ry=".17" opacity=".55" stroke-width="1.49"/>
   <rect x="58.2" y="53.7" width="26.4" height="12.5" ry=".17" opacity=".55" stroke-width="2.99"/>
  </g>
  <rect x="115" y="81.8" width="24.3" height="56.7" ry=".838" opacity=".55" stroke-width="1.53"/>
  <rect x="146" y="35" width="30.7" height="72" ry=".838" opacity=".55" stroke-width="3.31"/>
  <rect x="156" y="136" width="26.4" height="61.6" ry=".838" opacity=".55" stroke-width="6.64"/>

Note also that in my example above the stroke widths are scaled when the stretch is applied to the ungrouped objects. If you don't want that to happen, you can change that option in the preferences. Uncheck "Scale stroke width"

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.