Map values toFixed(1) and round option
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user