Can I use figma plugin API to do the same thing as "resize to fit" button in panel

image