From 55ed75f44d5d7971422bc19f3a1d0aaa2dbf3ca1 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 13 Apr 2025 00:33:06 -0500 Subject: [PATCH] [nostalgia/gfx/studio/tilesheet] Fix selection clearing to work when clicking outside image --- .../src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp | 1 - .../src/studio/tilesheeteditor/tilesheeteditormodel.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp index 6ec97e4a..3ef4d6b7 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditor-imgui.hpp @@ -10,7 +10,6 @@ #include #include -#include "tilesheetpixelgrid.hpp" #include "tilesheetpixels.hpp" #include "tilesheeteditorview.hpp" diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index 80c67685..02a3d126 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -263,7 +263,13 @@ ox::Error TileSheetEditorModel::rotateRight() noexcept { } void TileSheetEditorModel::setSelection(studio::Selection const&sel) noexcept { - m_selection.emplace(sel); + auto const &ss = activeSubSheet(); + if (sel.a.x < ss.columns * TileWidth && sel.a.y < ss.rows * TileHeight) { + m_selection.emplace(sel); + } else { + m_selTracker.finishSelection(); + m_selection.reset(); + } m_updated = true; }