fix empty diagram

This commit is contained in:
Alexander Wang 2022-12-06 18:23:22 -08:00
parent d541e44cd3
commit 10e58589de
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
3 changed files with 5 additions and 2 deletions

View file

@ -44,6 +44,9 @@ func (diagram Diagram) HashID() (string, error) {
}
func (diagram Diagram) BoundingBox() (topLeft, bottomRight Point) {
if len(diagram.Shapes) == 0 {
return Point{0, 0}, Point{0, 0}
}
x1 := int(math.MaxInt64)
y1 := int(math.MaxInt64)
x2 := int(-math.MaxInt64)

View file

@ -2,7 +2,7 @@
<svg
style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="202" height="202" viewBox="9223372036854775707 9223372036854775707 202 202"><style type="text/css">
width="200" height="200" viewBox="-100 -100 200 200"><style type="text/css">
<![CDATA[
.shape {
shape-rendering: geometricPrecision;

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 496 B

View file

@ -2,7 +2,7 @@
<svg
style="background: white;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="202" height="202" viewBox="9223372036854775707 9223372036854775707 202 202"><style type="text/css">
width="200" height="200" viewBox="-100 -100 200 200"><style type="text/css">
<![CDATA[
.shape {
shape-rendering: geometricPrecision;

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 496 B