【发布时间】:2019-08-26 03:09:20
【问题描述】:
我维护的网站中有许多内联 SVG,但它们在 Firefox 中已损坏。当应用矢量效果:非缩放笔画时,每个都会被破坏。它们仍然呈现,但最后/第一个点似乎被拉伸到页面的左上角。
例如https://drive.google.com/file/d/1gY-SO2fbtDRb9AGfeLXvJg3oCKosdrKd/view?usp=sharing 例如https://drive.google.com/file/d/1lpua-qZyiDlcfFKjLfXWgP8wOa_tZh69/view?usp=sharing
如果我将标签更改为椭圆,该问题似乎只适用于圆圈 例如
<ellipse class="stroke-blue stroke-2 no-fill stroke-rounded non-scaling-stroke" cx="69.9" cy="60.1" rx="40.8" ry="40.8"/>
问题消失了,如果我删除矢量效果
e.g. <circle class="stroke-blue stroke-2 no-fill stroke-rounded" cx="69.9" cy="60.1" r="40.8"/>
在 SVG 上运行鼠标光标有时也可以解决问题。
Codepen:https://codepen.io/anon/pen/WWQRqg
HTML:
<svg version="1.1" id="parents-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
<path class="stroke-blue stroke-2 no-fill non-scaling-stroke" d="M116.5,137.6c0,0-17.5-22.6-46.7-22.6c-32,0-52,24.1-58.9,43.9c0,0,25.8,19.8,56.9,19.8c20.2,0,32.4-5,32.4-5"/>
<path class="stroke-blue stroke-2 no-fill grey-stroke-hover non-scaling-stroke" d="M109.8,166.3c0,0,15.3,13.5,39.5,13.5s39.8-13.5,39.8-13.5S178.9,137,149.5,137S109.8,166.3,109.8,166.3z"/>
<circle class="stroke-blue stroke-2 no-fill stroke-rounded grey-stroke-hover non-scaling-stroke" cx="149.5" cy="100.4" r="27.1"/>
<circle class="stroke-blue stroke-2 no-fill stroke-rounded non-scaling-stroke" cx="69.9" cy="60.1" r="40.8"/>
</svg>
CSS:
.non-scaling-stroke {
vector-effect: non-scaling-stroke;
}
.stroke-2 {
stroke-width: 2;
stroke-miterlimit: 0;
}
.stroke-blue {
stroke: #009bdf;
}
.no-fill {
fill: none;
}
.stroke-rounded {
stroke-linecap: round;
stroke-linejoin: round;
}
【问题讨论】: