Show grid cell index in status bar (#2082)

This commit is contained in:
Liebranca 2024-09-10 10:30:35 -03:00 committed by David Capello
parent 951c2d0de9
commit ebd17b0ced

View File

@ -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);
}
}
}