(stage: StageDefinition)
| 146 | } |
| 147 | |
| 148 | function generateStageSvgPathString(stage: StageDefinition) { |
| 149 | const windowX = window.innerWidth; |
| 150 | const windowY = window.innerHeight; |
| 151 | |
| 152 | const stagePadding = getConfig("stagePadding") || 0; |
| 153 | const stageRadius = getConfig("stageRadius") || 0; |
| 154 | |
| 155 | const stageWidth = stage.width + stagePadding * 2; |
| 156 | const stageHeight = stage.height + stagePadding * 2; |
| 157 | |
| 158 | // prevent glitches when stage is too small for radius |
| 159 | const limitedRadius = Math.min(stageRadius, stageWidth / 2, stageHeight / 2); |
| 160 | |
| 161 | // no value below 0 allowed + round down |
| 162 | const normalizedRadius = Math.floor(Math.max(limitedRadius, 0)); |
| 163 | |
| 164 | const highlightBoxX = stage.x - stagePadding + normalizedRadius; |
| 165 | const highlightBoxY = stage.y - stagePadding; |
| 166 | const highlightBoxWidth = stageWidth - normalizedRadius * 2; |
| 167 | const highlightBoxHeight = stageHeight - normalizedRadius * 2; |
| 168 | |
| 169 | return `M${windowX},0L0,0L0,${windowY}L${windowX},${windowY}L${windowX},0Z |
| 170 | M${highlightBoxX},${highlightBoxY} h${highlightBoxWidth} a${normalizedRadius},${normalizedRadius} 0 0 1 ${normalizedRadius},${normalizedRadius} v${highlightBoxHeight} a${normalizedRadius},${normalizedRadius} 0 0 1 -${normalizedRadius},${normalizedRadius} h-${highlightBoxWidth} a${normalizedRadius},${normalizedRadius} 0 0 1 -${normalizedRadius},-${normalizedRadius} v-${highlightBoxHeight} a${normalizedRadius},${normalizedRadius} 0 0 1 ${normalizedRadius},-${normalizedRadius} z`; |
| 171 | } |
| 172 | |
| 173 | export function destroyOverlay() { |
| 174 | const overlaySvg = getState("__overlaySvg"); |
no test coverage detected
searching dependent graphs…