Always Show the tileset grid when we are in a tilemap layer (even when there is no active cel)

This commit is contained in:
David Capello 2019-08-05 09:09:41 -03:00
parent 99b1474bdf
commit 40c4c549cd

View File

@ -100,12 +100,11 @@ Grid Site::grid() const
gfx::Rect Site::gridBounds() const
{
if (m_layer && m_layer->isTilemap()) {
const Cel* cel = (m_layer ? m_layer->cel(m_frame): nullptr);
if (cel) {
const Grid& grid = static_cast<LayerTilemap*>(m_layer)->tileset()->grid();
return gfx::Rect(grid.tileOffset() + cel->bounds().origin(),
grid.tileSize());
}
const Grid& grid = static_cast<LayerTilemap*>(m_layer)->tileset()->grid();
gfx::Point offset = grid.tileOffset();
if (const Cel* cel = m_layer->cel(m_frame))
offset += cel->bounds().origin();
return gfx::Rect(offset, grid.tileSize());
}
gfx::Rect bounds;