feat(minimap): add pannable and zoomable props, remove interactive-minimap package
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user