1
0
forked from 0ad/0ad

Allow right-clicking to show template panel on queued items.

Request at:
https://wildfiregames.com/forum/topic/40311-a24a23-context-information/.

Differential revision: https://code.wildfiregames.com/D3983
This was SVN commit r25478.
This commit is contained in:
Freagarach 2021-05-21 07:11:05 +00:00
parent e1f9304601
commit 37c8e9caa8

View File

@ -539,16 +539,17 @@ g_SelectionPanels.Queue = {
data.button.onPress = function() { removeFromProductionQueue(data.item.producingEnt, queuedItem.id); };
let tooltip = getEntityNames(template);
const tooltips = [getEntityNames(template)];
if (queuedItem.neededSlots)
{
tooltip += "\n" + coloredText(translate("Insufficient population capacity:"), "red");
tooltip += "\n" + sprintf(translate("%(population)s %(neededSlots)s"), {
tooltips.push(coloredText(translate("Insufficient population capacity:"), "red"));
tooltips.push(sprintf(translate("%(population)s %(neededSlots)s"), {
"population": resourceIcon("population"),
"neededSlots": queuedItem.neededSlots
});
}));
}
data.button.tooltip = tooltip;
tooltips.push(showTemplateViewerOnRightClickTooltip(template));
data.button.tooltip = tooltips.join("\n");
data.countDisplay.caption = queuedItem.count > 1 ? queuedItem.count : "";
@ -569,6 +570,10 @@ g_SelectionPanels.Queue = {
data.button.enabled = controlsPlayer(data.player);
const showTemplateFunc = () => { showTemplateDetails(data.item.queuedItem.unitTemplate || data.item.queuedItem.technologyTemplate, data.playerState.civ); };
data.button.onPressRight = showTemplateFunc;
data.button.onPressRightDisabled = showTemplateFunc;
setPanelObjectPosition(data.button, data.i, data.rowLength);
return true;
}