3 ms·
This may be good if you know all your rect sizes in advance. But it seems like it will quickly fall apart if you have rectangles that need to change their size
by jakelazaroff 5y ago
This may be good if you know all your rect sizes in advance. But it seems like it will quickly fall apart if you have rectangles that need to change their size based on content, especially if that content is multiple levels deep.
Say you have a floating toolbar the width of two buttons, which themselves are the width of their text contents. You're back to square one — you have to measure the text of each button, then measure both buttons and finally you have the size of the toolbar.
- hsn915 5y agoYou will generally know the rough content of the text and allocate a size that looks good enough. A lot of people do this anyway even with css: specify the button width in pixels. Because a toolbar with buttons that have varying widths depending on their content is not always a very good looking toolbar.