Seems right. Thanks Gavin.
This commit is contained in:
parent
3b90f3502d
commit
100927e7dc
3 changed files with 19 additions and 18 deletions
|
|
@ -229,37 +229,38 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s
|
|||
}
|
||||
case d2target.FilledCircleArrowhead:
|
||||
attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth)
|
||||
radius := width / 2
|
||||
if isTarget {
|
||||
|
||||
path = fmt.Sprintf(`<circle %s clip-path="circle()" cx="%f" cy="%f" r="%f"/>`,
|
||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||
attrs,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(width/3.2)/strokeWidth*2,
|
||||
radius+strokeWidth/2,
|
||||
radius,
|
||||
radius-strokeWidth/2,
|
||||
)
|
||||
} else {
|
||||
path = fmt.Sprintf(`<circle %s clip-path="circle()" cx="%f" cy="%f" r="%f"/>`,
|
||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||
attrs,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(width/3.2)/strokeWidth*2,
|
||||
radius-strokeWidth/2,
|
||||
radius,
|
||||
radius-strokeWidth/2,
|
||||
)
|
||||
}
|
||||
case d2target.CircleArrowhead:
|
||||
attrs := fmt.Sprintf(`class="connection" fill="white" stroke="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth)
|
||||
radius := width / 2
|
||||
if isTarget {
|
||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||
attrs,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(width/3.2)/strokeWidth*2,
|
||||
radius+strokeWidth/2,
|
||||
radius,
|
||||
radius-strokeWidth,
|
||||
)
|
||||
} else {
|
||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||
attrs,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(height/1.6)/strokeWidth*2,
|
||||
(width/3.2)/strokeWidth*2,
|
||||
radius-strokeWidth/2,
|
||||
radius,
|
||||
radius-strokeWidth,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +310,7 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s
|
|||
var refX float64
|
||||
refY := height / 2
|
||||
switch arrowhead {
|
||||
case d2target.DiamondArrowhead, d2target.CircleArrowhead:
|
||||
case d2target.DiamondArrowhead:
|
||||
if isTarget {
|
||||
refX = width - 0.6*strokeWidth
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577"><style type="text/css">
|
|||
svgEl.setAttribute("height", height * ratio - 16);
|
||||
}
|
||||
});
|
||||
]]></script><g id="a"><g class="shape" ><rect x="0" y="0" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="56.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="0" y="247" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="56.500000" y="313.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="c"><g class="shape" ><rect x="174" y="0" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="230.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">c</text></g><g id="d"><g class="shape" ><rect x="173" y="247" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="230.000000" y="313.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">d</text></g><g id="(a <-> b)[0]"><marker id="mk-2353508688" markerWidth="28.000000" markerHeight="30.000000" refX="3.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="9.000000" cy="15.000000" r="8.750000"/> </marker><marker id="mk-3979614975" markerWidth="28.000000" markerHeight="30.000000" refX="25.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="19.000000" cy="15.000000" r="8.750000"/> </marker><path d="M 56.500000 130.000000 C 56.500000 174.400000 56.500000 198.700000 56.500000 243.500000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-2353508688)" marker-end="url(#mk-3979614975)" mask="url(#1982561420)"/><text class="text-italic" x="57.000000" y="192.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">circle</text></g><g id="(c <-> d)[0]"><marker id="mk-174437403" markerWidth="28.000000" markerHeight="30.000000" refX="3.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="9.000000" cy="15.000000" r="9.333333"/> </marker><marker id="mk-211976278" markerWidth="28.000000" markerHeight="30.000000" refX="25.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="19.000000" cy="15.000000" r="9.333333"/> </marker><path d="M 230.000000 130.000000 C 230.000000 174.400000 230.000000 198.700000 230.000000 243.500000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-174437403)" marker-end="url(#mk-211976278)" mask="url(#1982561420)"/><text class="text-italic" x="230.500000" y="192.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">filled-circle</text></g><mask id="1982561420" maskUnits="userSpaceOnUse" x="-100" y="-100" width="491" height="577">
|
||||
]]></script><g id="a"><g class="shape" ><rect x="0" y="0" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="56.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="0" y="247" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="56.500000" y="313.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="c"><g class="shape" ><rect x="174" y="0" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="230.500000" y="66.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">c</text></g><g id="d"><g class="shape" ><rect x="173" y="247" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="230.000000" y="313.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">d</text></g><g id="(a <-> b)[0]"><marker id="mk-2353508688" markerWidth="24.000000" markerHeight="24.000000" refX="3.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="11.000000" cy="12.000000" r="10.000000"/> </marker><marker id="mk-3979614975" markerWidth="24.000000" markerHeight="24.000000" refX="21.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="13.000000" cy="12.000000" r="10.000000"/> </marker><path d="M 56.500000 130.000000 C 56.500000 174.400000 56.500000 198.700000 56.500000 243.500000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-2353508688)" marker-end="url(#mk-3979614975)" mask="url(#1982561420)"/><text class="text-italic" x="57.000000" y="192.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">circle</text></g><g id="(c <-> d)[0]"><marker id="mk-174437403" markerWidth="24.000000" markerHeight="24.000000" refX="3.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="11.000000" cy="12.000000" r="11.000000"/> </marker><marker id="mk-211976278" markerWidth="24.000000" markerHeight="24.000000" refX="21.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="13.000000" cy="12.000000" r="11.000000"/> </marker><path d="M 230.000000 130.000000 C 230.000000 174.400000 230.000000 198.700000 230.000000 243.500000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-174437403)" marker-end="url(#mk-211976278)" mask="url(#1982561420)"/><text class="text-italic" x="230.500000" y="192.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">filled-circle</text></g><mask id="1982561420" maskUnits="userSpaceOnUse" x="-100" y="-100" width="491" height="577">
|
||||
<rect x="-100" y="-100" width="491" height="577" fill="white"></rect>
|
||||
<rect x="39.000000" y="176.000000" width="36" height="21" fill="black"></rect>
|
||||
<rect x="194.000000" y="176.000000" width="73" height="21" fill="black"></rect>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 470 KiB |
|
|
@ -39,7 +39,7 @@ width="451" height="677" viewBox="-90 -90 451 677"><style type="text/css">
|
|||
svgEl.setAttribute("height", height * ratio - 16);
|
||||
}
|
||||
});
|
||||
]]></script><g id="a"><g class="shape" ><rect x="12" y="12" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="68.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="12" y="359" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="68.500000" y="425.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="c"><g class="shape" ><rect x="145" y="12" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="201.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">c</text></g><g id="d"><g class="shape" ><rect x="145" y="359" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="202.000000" y="425.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">d</text></g><g id="(a <-> b)[0]"><marker id="mk-2353508688" markerWidth="28.000000" markerHeight="30.000000" refX="3.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="9.000000" cy="15.000000" r="8.750000"/> </marker><marker id="mk-3979614975" markerWidth="28.000000" markerHeight="30.000000" refX="25.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="19.000000" cy="15.000000" r="8.750000"/> </marker><path d="M 68.500000 142.000000 L 68.500000 355.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-2353508688)" marker-end="url(#mk-3979614975)" mask="url(#3604360783)"/><text class="text-italic" x="69.000000" y="254.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">circle</text></g><g id="(c <-> d)[0]"><marker id="mk-174437403" markerWidth="28.000000" markerHeight="30.000000" refX="3.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="9.000000" cy="15.000000" r="9.333333"/> </marker><marker id="mk-211976278" markerWidth="28.000000" markerHeight="30.000000" refX="25.000000" refY="15.000000" viewBox="0.000000 0.000000 28.000000 30.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="19.000000" cy="15.000000" r="9.333333"/> </marker><path d="M 202.000000 142.000000 L 202.000000 355.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-174437403)" marker-end="url(#mk-211976278)" mask="url(#3604360783)"/><text class="text-italic" x="202.500000" y="254.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">filled-circle</text></g><mask id="3604360783" maskUnits="userSpaceOnUse" x="-100" y="-100" width="451" height="677">
|
||||
]]></script><g id="a"><g class="shape" ><rect x="12" y="12" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="68.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">a</text></g><g id="b"><g class="shape" ><rect x="12" y="359" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="68.500000" y="425.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">b</text></g><g id="c"><g class="shape" ><rect x="145" y="12" width="113" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="201.500000" y="78.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">c</text></g><g id="d"><g class="shape" ><rect x="145" y="359" width="114" height="126" style="fill:#F7F8FE;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" /></g><text class="text-bold" x="202.000000" y="425.000000" style="text-anchor:middle;font-size:16px;fill:#0A0F25">d</text></g><g id="(a <-> b)[0]"><marker id="mk-2353508688" markerWidth="24.000000" markerHeight="24.000000" refX="3.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="11.000000" cy="12.000000" r="10.000000"/> </marker><marker id="mk-3979614975" markerWidth="24.000000" markerHeight="24.000000" refX="21.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="white" stroke="#0D32B2" stroke-width="2" cx="13.000000" cy="12.000000" r="10.000000"/> </marker><path d="M 68.500000 142.000000 L 68.500000 355.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-2353508688)" marker-end="url(#mk-3979614975)" mask="url(#3604360783)"/><text class="text-italic" x="69.000000" y="254.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">circle</text></g><g id="(c <-> d)[0]"><marker id="mk-174437403" markerWidth="24.000000" markerHeight="24.000000" refX="3.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="11.000000" cy="12.000000" r="11.000000"/> </marker><marker id="mk-211976278" markerWidth="24.000000" markerHeight="24.000000" refX="21.000000" refY="12.000000" viewBox="0.000000 0.000000 24.000000 24.000000" orient="auto" markerUnits="userSpaceOnUse"> <circle class="connection" fill="#0D32B2" stroke-width="2" cx="13.000000" cy="12.000000" r="11.000000"/> </marker><path d="M 202.000000 142.000000 L 202.000000 355.000000" class="connection" style="fill:none;stroke:#0D32B2;opacity:1.000000;stroke-width:2;" marker-start="url(#mk-174437403)" marker-end="url(#mk-211976278)" mask="url(#3604360783)"/><text class="text-italic" x="202.500000" y="254.000000" style="text-anchor:middle;font-size:16px;fill:#676C7E">filled-circle</text></g><mask id="3604360783" maskUnits="userSpaceOnUse" x="-100" y="-100" width="451" height="677">
|
||||
<rect x="-100" y="-100" width="451" height="677" fill="white"></rect>
|
||||
<rect x="51.000000" y="238.000000" width="36" height="21" fill="black"></rect>
|
||||
<rect x="166.000000" y="238.000000" width="73" height="21" fill="black"></rect>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 470 KiB |
Loading…
Reference in a new issue