added css variables for minimap mask, set default mask-stroke to 0

This commit is contained in:
peterkogo
2024-02-07 12:19:23 +01:00
parent 4c0a5a62c7
commit ceb160fa7b
3 changed files with 23 additions and 10 deletions
@@ -51,8 +51,8 @@ function MiniMapComponent({
nodeComponent,
bgColor,
maskColor,
maskStrokeColor = 'none',
maskStrokeWidth = 1,
maskStrokeColor,
maskStrokeWidth,
position = 'bottom-right',
onClick,
onNodeClick,
@@ -133,6 +133,9 @@ function MiniMapComponent({
...style,
'--xy-minimap-background-color-props': typeof bgColor === 'string' ? bgColor : undefined,
'--xy-minimap-mask-background-color-props': typeof maskColor === 'string' ? maskColor : undefined,
'--xy-minimap-mask-stroke-color-props': typeof maskStrokeColor === 'string' ? maskStrokeColor : undefined,
'--xy-minimap-mask-stroke-width-props':
typeof maskStrokeWidth === 'number' ? maskStrokeWidth * viewScale : undefined,
'--xy-minimap-node-background-color-props': typeof nodeColor === 'string' ? nodeColor : undefined,
'--xy-minimap-node-stroke-color-props': typeof nodeStrokeColor === 'string' ? nodeStrokeColor : undefined,
'--xy-minimap-node-stroke-width-props': typeof nodeStrokeWidth === 'string' ? nodeStrokeWidth : undefined,
@@ -166,8 +169,6 @@ function MiniMapComponent({
d={`M${x - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`}
fillRule="evenodd"
stroke={maskStrokeColor}
strokeWidth={maskStrokeWidth * viewScale}
pointerEvents="none"
/>
</svg>