Draw icon for tilemap layers in the tilemap

This commit is contained in:
David Capello 2020-10-23 17:19:56 -03:00
parent 3e55928d41
commit 0b4e24b29d
3 changed files with 29 additions and 11 deletions

View File

@ -861,6 +861,11 @@
<background-border part="timeline_none" state="focus mouse" />
<background-border part="timeline_none" state="selected" />
</style>
<style id="timeline_tilemap_layer">
<icon part="tiles" color="timeline_normal_text" align="left middle" x="4" />
<icon part="tiles" color="timeline_active_text" align="left middle" x="4" state="focus" />
<icon part="tiles" color="timeline_clicked_text" align="left middle" x="4" state="selected" />
</style>
<style id="timeline_header_frame" extends="timeline_box" font="mini">
<text color="timeline_normal_text" />
<text color="timeline_hover_text" state="mouse" />

View File

@ -854,6 +854,11 @@
<background-border part="timeline_none" state="focus mouse" />
<background-border part="timeline_none" state="selected" />
</style>
<style id="timeline_tilemap_layer">
<icon part="tiles" color="timeline_normal_text" align="left middle" x="4" />
<icon part="tiles" color="timeline_active_text" align="left middle" x="4" state="focus" />
<icon part="tiles" color="timeline_clicked_text" align="left middle" x="4" state="selected" />
</style>
<style id="timeline_header_frame" extends="timeline_box" font="mini">
<text color="timeline_normal_text" />
<text color="timeline_hover_text" state="mouse" />

View File

@ -2108,18 +2108,12 @@ void Timeline::drawLayer(ui::Graphics* g, int layerIdx)
textBounds.w -= w;
}
// Layer name background
drawPart(g, bounds, nullptr, styles.timelineLayer(),
is_active || (clklayer && m_clk.part == PART_ROW_TEXT),
(hotlayer && m_hot.part == PART_ROW_TEXT),
(clklayer && m_clk.part == PART_ROW_TEXT));
drawPart(g, textBounds,
&layer->name(),
styles.timelineLayer(),
is_active,
(hotlayer && m_hot.part == PART_ROW_TEXT),
(clklayer && m_clk.part == PART_ROW_TEXT));
if (doc::rgba_geta(layerColor) > 0) {
// Fill with an user-defined custom color.
auto b2 = textBounds;
@ -2129,15 +2123,29 @@ void Timeline::drawLayer(ui::Graphics* g, int layerIdx)
doc::rgba_getb(layerColor),
doc::rgba_geta(layerColor)),
b2);
}
drawPart(g, textBounds,
&layer->name(),
styles.timelineLayerTextOnly(),
is_active,
// Tilemap icon
if (layer->isTilemap()) {
drawPart(g, textBounds, nullptr, styles.timelineTilemapLayer(),
is_active || (clklayer && m_clk.part == PART_ROW_TEXT),
(hotlayer && m_hot.part == PART_ROW_TEXT),
(clklayer && m_clk.part == PART_ROW_TEXT));
gfx::Size sz = skinTheme()->calcSizeHint(
this, skinTheme()->styles.timelineTilemapLayer());
textBounds.x += sz.w;
textBounds.w -= sz.w;
}
// Layer text
drawPart(g, textBounds,
&layer->name(),
styles.timelineLayerTextOnly(),
is_active,
(hotlayer && m_hot.part == PART_ROW_TEXT),
(clklayer && m_clk.part == PART_ROW_TEXT));
if (layer->isBackground()) {
int s = ui::guiscale();
g->fillRect(