diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-09-08 17:07:22 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-09-08 17:07:22 +0200 |
commit | b145d957e3809fd6c2d814c34c58234ade983bb0 (patch) | |
tree | 3e8842c72afe0045645ad32a0b3a9ab708c575ee /src/gui/List.cpp | |
parent | 3d5e8baa5f66547f1250950b10bd4108e30af423 (diff) |
More
Diffstat (limited to 'src/gui/List.cpp')
-rw-r--r-- | src/gui/List.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/List.cpp b/src/gui/List.cpp index 849329f..81f0e80 100644 --- a/src/gui/List.cpp +++ b/src/gui/List.cpp @@ -52,6 +52,9 @@ namespace gsr { if(!widget->visible) continue; + if(i > 0) + draw_pos.y += spacing; + const auto widget_size = widget->get_size(); // TODO: Do this parent widget alignment for horizontal alignment and for other types of widget alignment // and other widgets. @@ -67,8 +70,6 @@ namespace gsr { if(widget.get() != selected_widget) widget->draw(window, mgl::vec2f(0.0f, 0.0f)); draw_pos.y += widget_size.y; - if(widget_size.y > 0.001f && i + 1 < widgets.size()) - draw_pos.y += spacing; } break; } @@ -78,6 +79,9 @@ namespace gsr { if(!widget->visible) continue; + if(i > 0) + draw_pos.x += spacing; + const auto widget_size = widget->get_size(); if(content_alignment == Alignment::CENTER) offset.y = floor(size.y * 0.5f - widget_size.y * 0.5f); @@ -88,8 +92,6 @@ namespace gsr { if(widget.get() != selected_widget) widget->draw(window, mgl::vec2f(0.0f, 0.0f)); draw_pos.x += widget_size.x; - if(widget_size.x > 0.001f && i + 1 < widgets.size()) - draw_pos.x += spacing; } break; } @@ -146,11 +148,12 @@ namespace gsr { if(!widget->visible) continue; + if(i > 0) + size.y += spacing; + const auto widget_size = widget->get_size(); size.x = std::max(size.x, widget_size.x); size.y += widget_size.y; - if(widget_size.y > 0.001f && i + 1 < widgets.size()) - size.y += spacing; } break; } @@ -160,10 +163,11 @@ namespace gsr { if(!widget->visible) continue; + if(i > 0) + size.x += spacing; + const auto widget_size = widget->get_size(); size.x += widget_size.x; - if(widget_size.x > 0.001f && i + 1 < widgets.size()) - size.x += spacing; size.y = std::max(size.y, widget_size.y); } break; |