MCPcopy
hub / github.com/antvis/Infographic / updateOriginViewBox

Method updateOriginViewBox

src/editor/plugins/reset-viewbox.ts:65–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 };
64
65 private updateOriginViewBox() {
66 const svg = this.editor.getDocument();
67 // In Node env or before render, fallback to current viewBox attribute
68 if (!svg.getBBox) {
69 this.originViewBox = viewBoxToString(getViewBox(svg));
70 return;
71 }
72
73 // In Browser, calculate fit
74 const { padding } = this.state.getOptions();
75 this.originViewBox = getBoundViewBox(svg, parsePadding(padding));
76 }
77
78 private handleViewBoxChange = (viewBox?: string) => {
79 const svg = this.editor.getDocument();

Callers 2

initMethod · 0.95
ResetViewBoxClass · 0.95

Calls 6

viewBoxToStringFunction · 0.90
getViewBoxFunction · 0.90
getBoundViewBoxFunction · 0.90
parsePaddingFunction · 0.90
getDocumentMethod · 0.65
getOptionsMethod · 0.65

Tested by

no test coverage detected