[EGD-3336] Fixed negative SizeLeft return bug.

This commit is contained in:
Przemyslaw Brudny
2020-07-15 12:31:57 +02:00
committed by PrzeBrudny
parent e25a17b29f
commit 093e414a1d
2 changed files with 6 additions and 3 deletions

View File

@@ -11,8 +11,10 @@ namespace style
constexpr uint32_t listPositionX = style::window::default_left_margin;
// Magic 1 -> discussed with Design for proper alignment.
constexpr uint32_t ListPositionY = style::header::height - 1;
constexpr uint32_t listHeight = style::window_height - ListPositionY - style::footer::height;
constexpr uint32_t listWidth = style::listview::body_width_with_scroll;
// Bottom margin need to be added to fit all elements.
constexpr uint32_t listHeight =
style::window_height - ListPositionY - style::footer::height + style::margins::small;
constexpr uint32_t listWidth = style::listview::body_width_with_scroll;
} // namespace threads
namespace threadItem

View File

@@ -6,6 +6,7 @@
#include "Rect.hpp"
#include <Alignment.hpp>
#include "LayoutSizeStore.hpp"
#include "log/log.hpp"
namespace gui
{
@@ -30,7 +31,7 @@ namespace gui
};
template <Axis axis> uint32_t sizeLeft(Item *it, Item::Area area = Item::Area::Min)
{
return it->getSize(axis) - sizeUsed<axis>(it);
return (sizeUsed<axis>(it) >= it->getSize(axis)) ? 0 : it->getSize(axis) - sizeUsed<axis>(it);
};
template <Axis axis> void resizeItems();