blob: bbd3c116f91b771fd5657a6f2f3ecfe0efa1fe36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include "cru/ui/render/LayoutHelper.h"
#include "cru/base/log/Logger.h"
namespace cru::ui::render {
float CalculateAnchorByAlignment(Alignment alignment, float start_point,
float content_length, float child_length) {
switch (alignment) {
case Alignment::Start:
return start_point;
case Alignment::Center:
return start_point + (content_length - child_length) / 2.0f;
case Alignment::End:
return start_point + content_length - child_length;
default:
return start_point;
}
}
} // namespace cru::ui::render
|