This commit is contained in:
Gavin Nishizawa 2023-02-28 13:32:56 -08:00
parent afb70dd526
commit a910a4aaa4
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -92,9 +92,10 @@ func Append(diagram *d2target.Diagram, ruler *textmeasure.Ruler, in []byte) []by
newOuterViewbox := fmt.Sprintf(`viewBox="0 0 %d %d"`, viewboxWidth, viewboxHeight) newOuterViewbox := fmt.Sprintf(`viewBox="0 0 %d %d"`, viewboxWidth, viewboxHeight)
newViewbox := fmt.Sprintf(`viewBox="%s %s %s %s"`, viewboxSlice[0], viewboxSlice[1], strconv.Itoa(viewboxWidth), strconv.Itoa(viewboxHeight)) newViewbox := fmt.Sprintf(`viewBox="%s %s %s %s"`, viewboxSlice[0], viewboxSlice[1], strconv.Itoa(viewboxWidth), strconv.Itoa(viewboxHeight))
// check if outer svg has dimensions set
dimensionsToUpdate := 2 dimensionsToUpdate := 2
if widthRegex.FindString(svgRegex.FindString(svg)) != "" { outerSVG := svgRegex.FindString(svg)
// if outer svg has dimensions set we also need to update it
if widthRegex.FindString(outerSVG) != "" {
dimensionsToUpdate++ dimensionsToUpdate++
} }