getflourish / Sketch-Set-Line-Height-Plugin

Set line height relative to font size
128 stars 7 forks source link

Line Height is applied even when pressing cancel #9

Open seltzdesign opened 5 years ago

seltzdesign commented 5 years ago

I love the idea of your plugin and can see its usefulness. Just noticed a small bug. When I have some text selected and press Cmd - L it opens your input panel. If I press Esc or Cancel it will still set the line height to whatever is in the textbox. So basically okay and cancel do the same thing.

This is using the latest version of the plugin (from Sketch Runner) and latest Sketch 53.2.

Thanks for fixing!

Armin.

seltzdesign commented 5 years ago

A possible workaround and feature at the same time would be that it prefills the line height to the current value. That way even if it applies it when pressing cancel it will stay at the same value.

seltzdesign commented 5 years ago

before during after

Oh, I see it kind of already does that, but the precision is not high enough. In the screenshots above (before, during, after). You can see it prefills with 1.2. But 24 * 1.2 = 28.8 and not 28. The actual line height multiplier would be 1.16666.. So you should at least internally use a proper float32 to store the multiplier. It seems like it reduces the accuracy to one digit.