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