From 9d2fe0e8144b9a48b6cbe90e57fc7d8492bcb286 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 28 May 2024 01:45:40 -0500 Subject: [PATCH] [studio] Add size function to Selection --- .../studio/modlib/include/studio/selectiontracker.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/olympic/studio/modlib/include/studio/selectiontracker.hpp b/src/olympic/studio/modlib/include/studio/selectiontracker.hpp index 99484ec7..ea21bad2 100644 --- a/src/olympic/studio/modlib/include/studio/selectiontracker.hpp +++ b/src/olympic/studio/modlib/include/studio/selectiontracker.hpp @@ -5,6 +5,7 @@ #include #include +#include #include 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) {