如何在更改折线或线或路径的笔触宽度时保持SVG标记的固定宽度和高度。 基本上我需要的是修复标记的宽度和高度,它不应该根据元素的笔触宽度增长。
以下是我的代码/ Editor
<?xml version="1.0"?><svg width="120" height="120" viewBox="0 0 120 120"
xmlns="http://www.w3.org/2000/svg" version="1.1"><defs>
<marker id="Triangle" viewBox="0 0 10 10" refX="1" refY="5"
markerWidth="6" markerHeight="6" orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker></defs><polyline points="10,90 50,80 90,20" fill="none" stroke="black"
stroke-width="2" marker-end="url(#Triangle)" /></svg>
答案 0 :(得分:3)
设置markerUnits="userSpaceOnUse"
<svg width="120" height="120" viewBox="0 0 120 120"
xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="Triangle" viewBox="0 0 10 10" refX="1" refY="5" orient="auto"
markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
</defs>
<polyline points="10,90 50,80 90,20" fill="none" stroke="black"
stroke-width="3" marker-end="url(#Triangle)" />
<polyline points="30,100 70,90 110,30" fill="none" stroke="black"
stroke-width="1" marker-end="url(#Triangle)" />
</svg>
&#13;