Map values toFixed(1) and round option

This commit is contained in:
Guntis Smaukstelis
2025-03-20 22:17:28 +02:00
parent 24a2ff5868
commit 1742931a20
3 changed files with 11 additions and 11 deletions
+10
View File
@@ -84,6 +84,16 @@ export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[
<> <>
<div class="grid-1-2"> <div class="grid-1-2">
<div> <div>
<div>
<label>
<input
type="checkbox"
checked={windSignals.roundValues[0]()}
onChange={e => windSignals.roundValues[1](e.target.checked)}
/>
Round values
</label>
</div>
{ props.showWind && <WindInputs signals={windSignals} /> } { props.showWind && <WindInputs signals={windSignals} /> }
</div> </div>
<div><IconInputs weatherIconsSingal={weatherIconsSingal} /></div> <div><IconInputs weatherIconsSingal={weatherIconsSingal} /></div>
-10
View File
@@ -17,16 +17,6 @@ export const WindInputs: Component<{signals: WindSignals}> = (
) => { ) => {
return ( return (
<> <>
<div>
<label>
<input
type="checkbox"
checked={getRoundValues()}
onChange={e => setRoundValues(e.target.checked)}
/>
Round values
</label>
</div>
<div> <div>
<input <input
type="text" type="text"
+1 -1
View File
@@ -39,7 +39,7 @@ export function drawOnMap(
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.textBaseline = "middle"; ctx.textBaseline = "middle";
ctx.fillStyle = "#000000"; ctx.fillStyle = "#000000";
const numericValue = roundValues ? Math.round(value) : value; const numericValue = roundValues ? Math.round(value) : value.toFixed(1);
const stringValue = numericValue.toString().replace(".", ","); const stringValue = numericValue.toString().replace(".", ",");
ctx.fillText(stringValue, localX, localY); ctx.fillText(stringValue, localX, localY);