[nostalgia/core/studio] Fix tile insert to correct input when inserting past the last tile
All checks were successful
Build / build (push) Successful in 3m11s

This commit is contained in:
Gary Talent 2025-01-11 15:38:11 -06:00
parent eb4cd7106d
commit c44d8678cb

View File

@ -58,8 +58,8 @@ void TileSheetEditorView::scrollH(ox::Vec2 const&paneSz, float wheelh) noexcept
void TileSheetEditorView::insertTile(ox::Vec2 const&paneSize, ox::Vec2 const&clickPos) noexcept {
auto pt = clickPoint(paneSize, clickPos);
auto const&s = m_model.activeSubSheet();
pt.x = ox::min(pt.x, s.columns * TileWidth);
pt.y = ox::min(pt.y, s.rows * TileHeight);
pt.x = ox::min(pt.x, s.columns * TileWidth - 1);
pt.y = ox::min(pt.y, s.rows * TileHeight - 1);
auto const tileIdx = ptToIdx(pt, s.columns) / PixelsPerTile;
m_model.insertTiles(m_model.activeSubSheetIdx(), tileIdx, 1);
}