Merge pull request #1099 from verluci/main
Fixed minimap node borders on Safari, Chrome, etc
This commit is contained in:
@@ -9,6 +9,7 @@ interface MiniMapNodeProps {
|
|||||||
borderRadius: number;
|
borderRadius: number;
|
||||||
className: string;
|
className: string;
|
||||||
color: string;
|
color: string;
|
||||||
|
shapeRendering: string;
|
||||||
strokeColor: string;
|
strokeColor: string;
|
||||||
strokeWidth: number;
|
strokeWidth: number;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
@@ -25,6 +26,7 @@ const MiniMapNode = ({
|
|||||||
strokeWidth,
|
strokeWidth,
|
||||||
className,
|
className,
|
||||||
borderRadius,
|
borderRadius,
|
||||||
|
shapeRendering
|
||||||
}: MiniMapNodeProps) => {
|
}: MiniMapNodeProps) => {
|
||||||
const { background, backgroundColor } = style || {};
|
const { background, backgroundColor } = style || {};
|
||||||
const fill = (color || background || backgroundColor) as string;
|
const fill = (color || background || backgroundColor) as string;
|
||||||
@@ -41,6 +43,7 @@ const MiniMapNode = ({
|
|||||||
fill={fill}
|
fill={fill}
|
||||||
stroke={strokeColor}
|
stroke={strokeColor}
|
||||||
strokeWidth={strokeWidth}
|
strokeWidth={strokeWidth}
|
||||||
|
shapeRendering={shapeRendering}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export interface MiniMapProps extends HTMLAttributes<SVGSVGElement> {
|
|||||||
maskColor?: string;
|
maskColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare const window: any;
|
||||||
|
|
||||||
const defaultWidth = 200;
|
const defaultWidth = 200;
|
||||||
const defaultHeight = 150;
|
const defaultHeight = 150;
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ const MiniMap = ({
|
|||||||
const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset;
|
const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset;
|
||||||
const width = viewWidth + offset * 2;
|
const width = viewWidth + offset * 2;
|
||||||
const height = viewHeight + offset * 2;
|
const height = viewHeight + offset * 2;
|
||||||
|
const shapeRendering = (typeof window === "undefined" || !!window.chrome) ? "crispEdges" : "geometricPrecision";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
@@ -86,6 +89,7 @@ const MiniMap = ({
|
|||||||
borderRadius={nodeBorderRadius}
|
borderRadius={nodeBorderRadius}
|
||||||
strokeColor={nodeStrokeColorFunc(node)}
|
strokeColor={nodeStrokeColorFunc(node)}
|
||||||
strokeWidth={nodeStrokeWidth}
|
strokeWidth={nodeStrokeWidth}
|
||||||
|
shapeRendering={shapeRendering}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<path
|
<path
|
||||||
|
|||||||
@@ -178,8 +178,4 @@
|
|||||||
z-index: 5;
|
z-index: 5;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
|
|
||||||
&-node {
|
|
||||||
shape-rendering: crispedges;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user