summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-01 19:45:50 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-01 19:45:50 +0100
commit472767f60387caf955d55d8a43e39e156d5e9457 (patch)
treee4920444d18d2d43bc44fc6d15890bab882e2756 /src
parent601c42ae7c7df2adbff931ff4ac30ba39499da69 (diff)
editor: improve switching snap modes
Diffstat (limited to 'src')
-rw-r--r--src/global-coords.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/global-coords.hpp b/src/global-coords.hpp
index 864725d3..5453662e 100644
--- a/src/global-coords.hpp
+++ b/src/global-coords.hpp
@@ -38,6 +38,7 @@ struct global_coords final {
constexpr global_coords operator-(Vector2i vec) const noexcept;
constexpr global_coords& operator+=(Vector2i vec) noexcept;
constexpr global_coords& operator-=(Vector2i vec) noexcept;
+ constexpr Vector2i operator-(global_coords other) const noexcept;
};
constexpr local_coords global_coords::local() const noexcept
@@ -79,4 +80,9 @@ constexpr global_coords& global_coords::operator-=(Vector2i vec) noexcept
return *this;
}
+constexpr Vector2i global_coords::operator-(global_coords other) const noexcept
+{
+ return to_signed() - other.to_signed();
+}
+
} // namespace floormat