Files
gliffy2drawio/svg_utils.go
2026-01-06 19:05:48 +11:00

23 lines
545 B
Go

package gliffy2drawio
import (
"regexp"
)
// SVGImporterUtils mirrors the Java helper but keeps a lightweight implementation.
// It currently preserves the original SVG and only updates the viewBox attribute
// if one is present.
type SVGImporterUtils struct {
}
var svgPattern = regexp.MustCompile(`viewBox="(.*?)"`)
func (s SVGImporterUtils) SetViewBox(svg string) string {
m := svgPattern.FindStringSubmatch(svg)
if len(m) == 0 {
return svg
}
// No bounding-box calculation available here; keep the existing viewBox.
return svg
}