Show current grid tile in status bar when the grid is visible (fix #1075)

This commit is contained in:
David Capello 2016-04-19 15:51:34 -03:00
parent fcca96d6a3
commit 33003fb6f9
3 changed files with 10 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -410,6 +410,7 @@
<part id="icon_angle" x="200" y="264" w="8" h="8" />
<part id="icon_key" x="208" y="264" w="8" h="8" />
<part id="icon_distance" x="216" y="264" w="8" h="8" />
<part id="icon_grid" x="224" y="264" w="8" h="8" />
</parts>
<stylesheet>

View File

@ -462,6 +462,7 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
(mask ? "selsize": "size"),
(mask ? mask->bounds().w: sprite->width()),
(mask ? mask->bounds().h: sprite->height()));
if (sprite->totalFrames() > 1) {
sprintf(
buf+std::strlen(buf), " :frame: %d :clock: %d",
@ -469,6 +470,14 @@ bool StandbyState::onUpdateStatusBar(Editor* editor)
sprite->frameDuration(editor->frame()));
}
if (editor->docPref().show.grid()) {
auto gb = editor->docPref().grid.bounds();
int col = (spritePos.x - (gb.x % gb.w)) / gb.w;
int row = (spritePos.y - (gb.y % gb.h)) / gb.h;
sprintf(
buf+std::strlen(buf), " :grid: %d %d", col, row);
}
StatusBar::instance()->setStatusText(0, buf);
}