MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / getViewBoxDimensions

Method getViewBoxDimensions

src/core/Decorations.ts:310–324  ·  view source on GitHub ↗
(rawSvg: string)

Source from the content-addressed store, hash-verified

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();

Callers 1

processSvgMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected