Skip to content

Commit

Permalink
use % values in tooltips to avoid re-rendering title constantly
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodrizer committed Jan 8, 2025
1 parent 2c66cb1 commit 701c59c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/jsx/left.jsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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",
Expand Down

0 comments on commit 701c59c

Please sign in to comment.