| 308 | } |
| 309 | |
| 310 | private getViewBoxDimensions(rawSvg: string) { |
| 311 | const viewBoxMatch = rawSvg.match(/viewBox="([^"]+)"/); |
| 312 | if (viewBoxMatch == null) { |
| 313 | throw Error("View box not found in svg"); |
| 314 | } |
| 315 | |
| 316 | const originalViewBoxString = viewBoxMatch[1]; |
| 317 | const [_0, _1, originalViewBoxWidthStr, originalViewBoxHeightStr] = |
| 318 | originalViewBoxString.split(" "); |
| 319 | |
| 320 | const originalViewBoxWidth = Number(originalViewBoxWidthStr); |
| 321 | const originalViewBoxHeight = Number(originalViewBoxHeightStr); |
| 322 | |
| 323 | return { originalViewBoxHeight, originalViewBoxWidth }; |
| 324 | } |
| 325 | |
| 326 | dispose() { |
| 327 | this.destroyDecorations(); |