edge case

This commit is contained in:
Alexander Wang 2023-01-19 15:13:18 -08:00
parent 568742e50a
commit 098fc96bd9
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
5 changed files with 13 additions and 4 deletions

View file

@ -152,5 +152,14 @@ func boundingBox(g *d2graph.Graph) (tl, br *geo.Point) {
}
}
if math.IsInf(x1, 1) && math.IsInf(x2, -1) {
x1 = 0
x2 = 0
}
if math.IsInf(y1, 1) && math.IsInf(y2, -1) {
y1 = 0
y2 = 0
}
return geo.NewPoint(x1, y1), geo.NewPoint(x2, y2)
}

View file

@ -87,7 +87,7 @@
"type": "",
"pos": {
"x": -189,
"y": 0
"y": -63
},
"width": 112,
"height": 126,

View file

@ -39,7 +39,7 @@ width="450" height="496" viewBox="-291 -248 450 496"><style type="text/css">
svgEl.setAttribute("height", height * ratio - 16);
}
});
]]></script><g id="x"><g class="shape" ><rect x="-56" y="-146" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.500000" y="-80.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">x</text></g><g id="y"><g class="shape" ><rect x="-57" y="20" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.000000" y="86.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">y</text></g><g id="z"><g class="shape" ><rect x="-189" y="0" width="112" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="-133.000000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">z</text></g><mask id="358045695" maskUnits="userSpaceOnUse" x="-100" y="-100" width="450" height="496">
]]></script><g id="x"><g class="shape" ><rect x="-56" y="-146" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.500000" y="-80.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">x</text></g><g id="y"><g class="shape" ><rect x="-57" y="20" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.000000" y="86.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">y</text></g><g id="z"><g class="shape" ><rect x="-189" y="-63" width="112" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="-133.000000" y="3.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">z</text></g><mask id="1584545407" maskUnits="userSpaceOnUse" x="-100" y="-100" width="450" height="496">
<rect x="-100" y="-100" width="450" height="496" fill="white"></rect>
</mask><style type="text/css"><![CDATA[

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View file

@ -87,7 +87,7 @@
"type": "",
"pos": {
"x": -189,
"y": 0
"y": -63
},
"width": 112,
"height": 126,

View file

@ -39,7 +39,7 @@ width="450" height="496" viewBox="-291 -248 450 496"><style type="text/css">
svgEl.setAttribute("height", height * ratio - 16);
}
});
]]></script><g id="x"><g class="shape" ><rect x="-56" y="-146" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.500000" y="-80.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">x</text></g><g id="y"><g class="shape" ><rect x="-57" y="20" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.000000" y="86.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">y</text></g><g id="z"><g class="shape" ><rect x="-189" y="0" width="112" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="-133.000000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">z</text></g><mask id="358045695" maskUnits="userSpaceOnUse" x="-100" y="-100" width="450" height="496">
]]></script><g id="x"><g class="shape" ><rect x="-56" y="-146" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.500000" y="-80.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">x</text></g><g id="y"><g class="shape" ><rect x="-57" y="20" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="0.000000" y="86.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">y</text></g><g id="z"><g class="shape" ><rect x="-189" y="-63" width="112" height="126" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g><text class="text-bold" x="-133.000000" y="3.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">z</text></g><mask id="1584545407" maskUnits="userSpaceOnUse" x="-100" y="-100" width="450" height="496">
<rect x="-100" y="-100" width="450" height="496" fill="white"></rect>
</mask><style type="text/css"><![CDATA[

Before

Width:  |  Height:  |  Size: 325 KiB

After

Width:  |  Height:  |  Size: 325 KiB