[studio] Add size function to Selection

This commit is contained in:
Gary Talent 2024-05-28 01:45:40 -05:00
parent f189469926
commit 9d2fe0e814

View File

@ -5,6 +5,7 @@
#include <ox/std/math.hpp>
#include <ox/std/point.hpp>
#include <ox/std/size.hpp>
#include <ox/std/typetraits.hpp>
namespace studio {
@ -13,6 +14,10 @@ struct Selection {
ox::Point a, b;
constexpr Selection() noexcept = default;
constexpr Selection(ox::Point const&pA, ox::Point const&pB) noexcept: a(pA), b(pB) {}
[[nodiscard]]
constexpr ox::Size size() const noexcept {
return {b.x - a.x, b.y - a.y};
}
};
constexpr auto iterateSelection(studio::Selection const&sel, auto const&cb) {