feat(minimap): add offsetScale and selected class name

This commit is contained in:
moklick
2023-08-14 16:22:36 +02:00
parent 182c53113c
commit f150c87997
4 changed files with 8 additions and 3 deletions
@@ -58,7 +58,8 @@ function MiniMap({
zoomable = false,
ariaLabel = 'React Flow mini map',
inversePan,
zoomStep,
zoomStep = 10,
offsetScale = 5,
}: MiniMapProps) {
const store = useStoreApi();
const svg = useRef<SVGSVGElement>(null);
@@ -70,7 +71,7 @@ function MiniMap({
const viewScale = Math.max(scaledWidth, scaledHeight);
const viewWidth = viewScale * elementWidth;
const viewHeight = viewScale * elementHeight;
const offset = 5 * viewScale;
const offset = offsetScale * viewScale;
const x = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset;
const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset;
const width = viewWidth + offset * 2;