Copy link to clipboard
Copied
Good day everyone!
This one thing is kind of surprising for me and I don't get why it happens.
When I run a scaling matrix on a shape or a group of shapes, the stroke width is set to 1000pts after transformation... whether I scale up or down, whatever the original width of the stroke. This makes no sense to me...
If you want to try for yourself and see if does the same, here's my test script line (whatever the scaling number, the issue happens):
activeDocument.selection[0].transform(app.getScaleMatrix(125,125))
So, is it a bug? I could understand that the scaling matrix wouldn't scale the stroke, and I woud know how to work around that in my scripts, but this is really absurd.
Thanks for your insight on this everyone!
changeLineWidths is optional but I think if not provided, it defaults to 100.
if you don't want to scale strokes, use a value of 1, otherwise calculate the exact value.
var scaleX = 200;
var scaleY = 200;
var changeLineWidths = ((scaleX+scaleY)/2)/100;
activeDocument.selection[0].transform(app.getScaleMatrix(scaleX, scaleY), true, true, true, true, changeLineWidths, Transformation.CENTER);
Copy link to clipboard
Copied
changeLineWidths is optional but I think if not provided, it defaults to 100.
if you don't want to scale strokes, use a value of 1, otherwise calculate the exact value.
var scaleX = 200;
var scaleY = 200;
var changeLineWidths = ((scaleX+scaleY)/2)/100;
activeDocument.selection[0].transform(app.getScaleMatrix(scaleX, scaleY), true, true, true, true, changeLineWidths, Transformation.CENTER);
Copy link to clipboard
Copied
Hi @CarlosCanto, thanks a lot for the reply!
Okay, so I really get how the function works, the documentation wasn't really clear on what the booleans do and the changeLineWidth (they should provide the default values in the Javascript Reference!).
Thanks a lot again, everything "clicked" for me now.
Copy link to clipboard
Copied
I hear you, the guides don't explain this part and others. Luckily the awesome community has figured out most of the intricate parts.