feat(minimap): add nodeStrokeWidth option closes #862
This commit is contained in:
@@ -10,10 +10,22 @@ interface MiniMapNodeProps {
|
|||||||
className: string;
|
className: string;
|
||||||
color: string;
|
color: string;
|
||||||
strokeColor: string;
|
strokeColor: string;
|
||||||
|
strokeWidth: number;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MiniMapNode = ({ x, y, width, height, style, color, strokeColor, className, borderRadius }: MiniMapNodeProps) => {
|
const MiniMapNode = ({
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
style,
|
||||||
|
color,
|
||||||
|
strokeColor,
|
||||||
|
strokeWidth,
|
||||||
|
className,
|
||||||
|
borderRadius,
|
||||||
|
}: MiniMapNodeProps) => {
|
||||||
const { background, backgroundColor } = style || {};
|
const { background, backgroundColor } = style || {};
|
||||||
const fill = (color || background || backgroundColor) as string;
|
const fill = (color || background || backgroundColor) as string;
|
||||||
|
|
||||||
@@ -28,7 +40,7 @@ const MiniMapNode = ({ x, y, width, height, style, color, strokeColor, className
|
|||||||
height={height}
|
height={height}
|
||||||
fill={fill}
|
fill={fill}
|
||||||
stroke={strokeColor}
|
stroke={strokeColor}
|
||||||
strokeWidth={2}
|
strokeWidth={strokeWidth}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface MiniMapProps extends React.HTMLAttributes<SVGSVGElement> {
|
|||||||
nodeStrokeColor?: string | StringFunc;
|
nodeStrokeColor?: string | StringFunc;
|
||||||
nodeClassName?: string | StringFunc;
|
nodeClassName?: string | StringFunc;
|
||||||
nodeBorderRadius?: number;
|
nodeBorderRadius?: number;
|
||||||
|
nodeStrokeWidth?: number;
|
||||||
maskColor?: string;
|
maskColor?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ const MiniMap = ({
|
|||||||
nodeColor = '#fff',
|
nodeColor = '#fff',
|
||||||
nodeClassName = '',
|
nodeClassName = '',
|
||||||
nodeBorderRadius = 5,
|
nodeBorderRadius = 5,
|
||||||
|
nodeStrokeWidth = 2,
|
||||||
maskColor = 'rgb(240, 242, 243, 0.7)',
|
maskColor = 'rgb(240, 242, 243, 0.7)',
|
||||||
}: MiniMapProps) => {
|
}: MiniMapProps) => {
|
||||||
const containerWidth = useStoreState((s) => s.width);
|
const containerWidth = useStoreState((s) => s.width);
|
||||||
@@ -83,6 +85,7 @@ const MiniMap = ({
|
|||||||
color={nodeColorFunc(node)}
|
color={nodeColorFunc(node)}
|
||||||
borderRadius={nodeBorderRadius}
|
borderRadius={nodeBorderRadius}
|
||||||
strokeColor={nodeStrokeColorFunc(node)}
|
strokeColor={nodeStrokeColorFunc(node)}
|
||||||
|
strokeWidth={nodeStrokeWidth}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<path
|
<path
|
||||||
|
|||||||
@@ -178,4 +178,8 @@
|
|||||||
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