From 7781886dd79ddab16eaf2d6de0c2b15781fbaab8 Mon Sep 17 00:00:00 2001 From: Coen Date: Thu, 15 Apr 2021 14:06:33 +0200 Subject: [PATCH 1/3] Fixed minimap on Safari, Chrome, etc --- src/additional-components/MiniMap/MiniMapNode.tsx | 3 +++ src/additional-components/MiniMap/index.tsx | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/additional-components/MiniMap/MiniMapNode.tsx b/src/additional-components/MiniMap/MiniMapNode.tsx index e2159328..d8a48e9e 100644 --- a/src/additional-components/MiniMap/MiniMapNode.tsx +++ b/src/additional-components/MiniMap/MiniMapNode.tsx @@ -9,6 +9,7 @@ interface MiniMapNodeProps { borderRadius: number; className: string; color: string; + shapeRendering: string; strokeColor: string; strokeWidth: number; style?: CSSProperties; @@ -25,6 +26,7 @@ const MiniMapNode = ({ strokeWidth, className, borderRadius, + shapeRendering }: MiniMapNodeProps) => { const { background, backgroundColor } = style || {}; const fill = (color || background || backgroundColor) as string; @@ -41,6 +43,7 @@ const MiniMapNode = ({ fill={fill} stroke={strokeColor} strokeWidth={strokeWidth} + shapeRendering={shapeRendering} /> ); }; diff --git a/src/additional-components/MiniMap/index.tsx b/src/additional-components/MiniMap/index.tsx index cc7fd6ab..563ae2e2 100644 --- a/src/additional-components/MiniMap/index.tsx +++ b/src/additional-components/MiniMap/index.tsx @@ -17,6 +17,8 @@ export interface MiniMapProps extends HTMLAttributes { maskColor?: string; } +declare const window: any; + const defaultWidth = 200; const defaultHeight = 150; @@ -62,6 +64,7 @@ const MiniMap = ({ const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset; const width = viewWidth + offset * 2; const height = viewHeight + offset * 2; + const shapeRendering = !!window.chrome ? "crispEdges" : "geometricPrecision"; return ( ))} Date: Thu, 15 Apr 2021 14:12:56 +0200 Subject: [PATCH 2/3] move shape-rendering to svg component --- src/style.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/style.css b/src/style.css index 6ff9db4f..5b2d7d2c 100644 --- a/src/style.css +++ b/src/style.css @@ -178,8 +178,4 @@ z-index: 5; bottom: 10px; right: 10px; - - &-node { - shape-rendering: crispedges; - } } From ec57c12630a8d38cd47557294526fa55f268bfa7 Mon Sep 17 00:00:00 2001 From: Coen Date: Thu, 15 Apr 2021 16:26:20 +0200 Subject: [PATCH 3/3] If window is undefined default to crispEdges --- src/additional-components/MiniMap/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/additional-components/MiniMap/index.tsx b/src/additional-components/MiniMap/index.tsx index 563ae2e2..dbb86f6c 100644 --- a/src/additional-components/MiniMap/index.tsx +++ b/src/additional-components/MiniMap/index.tsx @@ -64,7 +64,7 @@ const MiniMap = ({ const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset; const width = viewWidth + offset * 2; const height = viewHeight + offset * 2; - const shapeRendering = !!window.chrome ? "crispEdges" : "geometricPrecision"; + const shapeRendering = (typeof window === "undefined" || !!window.chrome) ? "crispEdges" : "geometricPrecision"; return (