#include namespace psemek::ui::impl { single_container_base::single_container_base(react::value> margin) : margin_(std::move(margin)) {} void single_container_base::reshape(geom::box const & new_shape) { single_container::reshape(new_shape); if (child()) child()->reshape(geom::shrink(new_shape, *margin_)); } geom::interval single_container_base::size_constraints(int dimension, float other_dimension_size) const { geom::interval result = single_container::size_constraints(dimension, other_dimension_size); if (child()) result = child()->size_constraints(dimension, other_dimension_size - 2.f * (*margin_)[dimension ^ 1]); return result + 2.f * (*margin_)[dimension]; } }