[studio] Add size function to Selection
This commit is contained in:
parent
f189469926
commit
9d2fe0e814
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user