35 lines
705 B
C++
35 lines
705 B
C++
#include <psemek/ui/impl/shape_reader_base.hpp>
|
|
|
|
namespace psemek::ui::impl
|
|
{
|
|
|
|
shape_reader_base::shape_reader_base()
|
|
: shape_(geom::box<float, 2>{{{0.f, 0.f}, {0.f, 0.f}}})
|
|
{}
|
|
|
|
void shape_reader_base::reshape(geom::box<float, 2> const & new_shape)
|
|
{
|
|
single_container::reshape(new_shape);
|
|
|
|
if (auto child = this->child())
|
|
child->reshape(new_shape);
|
|
|
|
shape_.set(new_shape);
|
|
}
|
|
|
|
react::value<struct size_constraints> shape_reader_base::size_constraints() const
|
|
{
|
|
if (auto child = this->child())
|
|
return child->size_constraints();
|
|
|
|
return size_constraints::max();
|
|
}
|
|
|
|
void shape_reader_base::update(shape_reader const & value)
|
|
{
|
|
shape_ = value.shape;
|
|
|
|
shape_.set(shape());
|
|
}
|
|
|
|
}
|