sky-chaser-high / adobe-illustrator-scripts

This is a collection of scripts for Adobe Illustrator.
MIT License
111 stars 8 forks source link

The resetToFullScale,How to maintain the rotation angle of the object #4

Closed jxyun99 closed 1 year ago

jxyun99 commented 1 year ago

resetToFullScale.js if I want to maintain the rotation angle of the object,What should I do?

sky-chaser-high commented 1 year ago

Hi jxyun99.

The angle is recorded in Tag. It would be an easy way to get the value from there and then restore the angle.

For example:

var item = app.activeDocument.selection[0];
var tag = item.tags[0];
var value = tag.value;

// convert radian to degree
var deg = 180 / Math.PI * value;

resetToFullScale(item);

// restore the angle
item.rotate(deg);
jxyun99 commented 1 year ago

https://github.com/jxyun99/test/blob/main/test.gif

I seem to have found a bug. If an object is rotated by an angle, such as -180°, the position after resizing will not be the original position

https://github.com/jxyun99/test/blob/main/test.gif is Presentation Diagram

sky-chaser-high commented 1 year ago

I have confirmed the bug here as well. I'll fix it.

sky-chaser-high commented 1 year ago

Fixed a bug.

jxyun99 commented 1 year ago

Thank you. I just tested it is ok