feat(minimap): add pannable and zoomable props, remove interactive-minimap package

This commit is contained in:
moklick
2022-11-01 22:45:08 +01:00
parent 0f855308cc
commit a96044b2a2
17 changed files with 106 additions and 398 deletions
+6 -1
View File
@@ -1,8 +1,9 @@
import { memo } from 'react';
import type { CSSProperties } from 'react';
import type { CSSProperties, MouseEvent } from 'react';
import cc from 'classcat';
interface MiniMapNodeProps {
id: string;
x: number;
y: number;
width: number;
@@ -14,9 +15,11 @@ interface MiniMapNodeProps {
strokeColor: string;
strokeWidth: number;
style?: CSSProperties;
onClick?: (event: MouseEvent, id: string) => void;
}
const MiniMapNode = ({
id,
x,
y,
width,
@@ -28,6 +31,7 @@ const MiniMapNode = ({
className,
borderRadius,
shapeRendering,
onClick,
}: MiniMapNodeProps) => {
const { background, backgroundColor } = style || {};
const fill = (color || background || backgroundColor) as string;
@@ -45,6 +49,7 @@ const MiniMapNode = ({
stroke={strokeColor}
strokeWidth={strokeWidth}
shapeRendering={shapeRendering}
onClick={onClick ? (event) => onClick(event, id) : undefined}
/>
);
};