//
// Created by sebastian on 10.02.26.
//

#ifndef DICEWARS_SIEDLER_UIPOSITIONER_H
#define DICEWARS_SIEDLER_UIPOSITIONER_H
#include "../Dimensions.h"
#include <glm/vec2.hpp>

#include "LayoutStyle.h"
class UiComponent; // forward declaration

class UiPositioner {
public:
    Dimensions screenSpace = Dimensions();
    explicit UiPositioner(UiComponent& uiComponent): uiComponent(uiComponent), style() {}
    UiPositioner(UiComponent& uiComponent, const LayoutStyle& style): uiComponent(uiComponent), style(style) {}


    void compute(const Dimensions& parentDimensions);

    LayoutStyle & getLayout();
    void setLayout(const LayoutStyle &style);

private:
    UiComponent& uiComponent;
    LayoutStyle style;

    float resolve(const SizeValue &size, float parentSize, float axisLength);
};


#endif //DICEWARS_SIEDLER_UIPOSITIONER_H