Merge pull request #399 from alixander/fix-empty

fix empty diagram
This commit is contained in:
Alexander Wang 2022-12-06 18:25:33 -08:00 committed by GitHub
commit dd0f48eebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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