From 701c59c4e21c4a6e044fdf69d04a7f0566e49ec1 Mon Sep 17 00:00:00 2001 From: bloodrizer Date: Tue, 7 Jan 2025 16:56:44 -0800 Subject: [PATCH] use % values in tooltips to avoid re-rendering title constantly --- js/jsx/left.jsx.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/jsx/left.jsx.js b/js/jsx/left.jsx.js index 6b895aa70..d2853efc5 100644 --- a/js/jsx/left.jsx.js +++ b/js/jsx/left.jsx.js @@ -205,6 +205,8 @@ WResourceRow = React.createClass({ (!res.visible ? " hidden" : "") ; + var resPercent = ((res.value / res.maxValue) * 100).toFixed(); + return $r("div", {role: "row", className: resRowClass}, [ this.props.isEditMode ? $r("div", {className:"res-cell"}, @@ -221,7 +223,7 @@ WResourceRow = React.createClass({ className:"res-cell resource-name", style:resNameCss, onClick: this.onClickName, - title: (res.title || res.name) + " " + game.getDisplayValueExt(res.value) + "/" + game.getDisplayValueExt(res.maxValue) + " " + perTickVal, + title: (res.title || res.name) + " " + resPercent + "%/" + game.getDisplayValueExt(res.maxValue) + " " + perTickVal, role: "gridcell", userFocus:"normal", tabIndex:"0",