You can now prefix a size with % and it will do percentage for the size, even over 100.

This commit is contained in:
Zed A. Shaw 2025-02-15 12:52:26 -05:00
parent d558da1620
commit c03a384372
6 changed files with 60 additions and 46 deletions

View file

@ -40,6 +40,11 @@ namespace lel {
cell.max_w = cell.max_w == 0 ? cell_width : cell.max_w;
cell.max_h = cell.max_h == 0 ? cell_height : cell.max_h;
if(cell.percent) {
cell.max_w = cell.max_w * 0.01 * cell_width;
cell.max_h = cell.max_h * 0.01 * cell_height;
}
cell.w = cell.expand ? std::min(cell.max_w, grid_w) : std::min(cell_width, cell.max_w);
cell.h = cell.expand ? std::min(cell.max_h, grid_h) : std::min(cell_height, cell.max_h);