From ebd17b0ced4ce14f68c4828e766e16c174aa217d Mon Sep 17 00:00:00 2001 From: Liebranca Date: Tue, 10 Sep 2024 10:30:35 -0300 Subject: [PATCH] Show grid cell index in status bar (#2082) --- src/app/ui/editor/standby_state.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index be43ca277..1ae540ded 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -610,6 +610,18 @@ bool StandbyState::onUpdateStatusBar(Editor* editor) buf += fmt::format(" [{}{}]", ti, str); } } + // Show the grid cell index + if (sprite->bounds().contains(gfx::Point(spritePos))) { + int columns = int(std::floor( + sprite->bounds().w/grid.tileSize().w)); + int rows = int(std::floor( + sprite->bounds().h/grid.tileSize().h)); + int column = (columns ? pt.x%columns: 0); + int row = (rows ? pt.y%rows: 0); + if (row < 0) row = row + rows; + if (column < 0) column = column + columns; + buf += fmt::format(" :search: {}", column+row*columns); + } } }