ddwht / sketch-dynamic-button

Dynamic button plugin for Sketch.app
1.05k stars 57 forks source link

Request to include minimum/maximum width? #42

Closed donnavitan closed 7 years ago

donnavitan commented 7 years ago

To start, I absolutely love this plugin and share it all the time with my co-workers. I appreciate anyone who take the time to make sure that this continues to work.

Is it possible to include minimum/maximum width?

It would definitely help me in my day-to-day work. I like having the button expand accordingly to the content but sometimes, I need the thing to be a certain width. For example, my button should have a minimum width of 100px and if text expands past that, it should follow the padding as prescribed. Or I may have a card component that needs to be a certain width.

fuggfuggfugg commented 7 years ago

Unfortunately this is a bit complicated. There are a lot of things in play here,

I'm writing as I'm thinking out loud

The BG layer ie the button background doesn't have an auto fixed option like the text does, which means you will have to set an extra parameter in the layer name. Even if I can code that, and fix the min width of the button to 100, then I will have to look at the text layers label to see how much padding has been set eg(20:20), then calculate what the total width text width + padding, if greater then run else leave width.

I will also need to consider the first time the plugin is run, then the bg width can be greater or less than min width, then you specify min width in the BG layer, then run cmd+j again then it needs to calculate accordingly.

I'll think about it more. Can't guarantee you anything but I will try and it could help other designers too.

donnavitan commented 7 years ago

Of course! It'd be nice to have. It doesn't take away from the fact that this a must-have plugin in my opinion! Cheers!

donnavitan commented 7 years ago

Oh man! I should be referring to this plugin. Sorry! https://github.com/fuggfuggfugg/sketch-dynamic-button-3.5