How can I batch resize the longest sides of the elements I have selected? In other words, how can I batch resize to fit into a frame with a specific size?
I have a lot of vectors. They are all in different sizes, and I want to resize them to fit into a 20x20px frame. It is easy to batch resize all the vectors so that they all have a 20px width or a 20px height. But I want them to be 20px on their longest side, which for some vectors is the width and for others the height.
I haven’t been able to find any Figma functions or plugins that allow me to do this. My current solution is this:
- Select parent frames
- Plugins > Automater > Object > Add Autolayout to each
- Set AL alignment to center
- Set height & width to fixed, 20px
- Select vectors (Enter)
- Plugins > Automater > Resize > Scale to fit to parent
- Select parent frames (Shift+Enter)
- Set height & width to 24px
- Plugins > Remove Autolayout Faster
I use Autolayout because I want the vectors to be centered inside the 20x20px frame (AFAIK there is no way to batch Align the vectors inside their parent frames), which does not happen automatically when using the Automater plugin’s Resize to Fit option. I have to remove Autolayout again in the last step because otherwise the vectors will not scale along with the frame when I resize the frame later. Unfortunately, removing Autolayout with Remove Autolayout Faster takes a very long time for the hundreds of frames I have. Disable Autolayout is faster but it doesn’t work on components, and my frames are components.
Does anyone have a better/faster way to do this?