1
0
forked from 0ad/0ad

Fix positioning of the research progress icons below the counters overlay

Bug found by: ffffffff
Differential Revision: https://code.wildfiregames.com/D3525
This was SVN commit r24868.
This commit is contained in:
Imarok 2021-02-10 16:59:50 +00:00
parent 5e1b84ed64
commit 11fde58751
2 changed files with 12 additions and 2 deletions

View File

@ -13,6 +13,7 @@ class OverlayCounterManager
this.enabledCounters = [];
this.lastTick = undefined;
this.resizeHandlers = [];
this.lastHeight = undefined;
this.initSize = this.dataCounter.size;
for (let name of this.availableCounterNames())
@ -91,6 +92,7 @@ class OverlayCounterManager
txt += newTxt + "\n";
}
let height;
if (lineCount)
{
this.dataCounter.caption = txt;
@ -103,12 +105,19 @@ class OverlayCounterManager
size.bottom = size.top + textSize.height;
size.left = size.right - textSize.width;
this.dataCounter.size = size;
height = textSize.height;
}
else
height = 0;
this.dataCounter.hidden = !lineCount;
for (let handler of this.resizeHandlers)
handler(textSize);
if (this.lastHeight != height)
{
this.lastHeight = height;
for (let handler of this.resizeHandlers)
handler(height);
}
}
}

View File

@ -17,6 +17,7 @@ class ResearchProgress
let updater = this.updateResearchProgress.bind(this);
registerSimulationUpdateHandler(updater);
playerViewControl.registerViewedPlayerChangeHandler(updater);
g_OverlayCounterManager.registerResizeHandler(this.setTopOffset.bind(this));
}
setTopOffset(offset)