From a70fe56a82b64eda44039c5bf393d090d24f40ff Mon Sep 17 00:00:00 2001 From: Guntis Smaukstelis Date: Thu, 8 Feb 2024 15:42:36 +0200 Subject: [PATCH] Fix canvas rescaling proportions with css --- web/src/cities/map/MapView.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/cities/map/MapView.tsx b/web/src/cities/map/MapView.tsx index cdbdd4f..8557823 100644 --- a/web/src/cities/map/MapView.tsx +++ b/web/src/cities/map/MapView.tsx @@ -68,6 +68,12 @@ export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[ ); }); + const getStyleSize = () => { + return props.width === 1920 + ? { "width": "1000px", "height": "562px" } + : { "width": "1000px", "height": "374px" }; + } + return ( <> { props.showWind && } @@ -75,7 +81,7 @@ export const MapView: Component<{ type: MapResolution, data: () => ResultKeyVal[ ref={setCanvas} width={props.width+"px"} height={props.height+"px"} - style={{"max-width": "1000px"}} + style={getStyleSize()} /> );