【发布时间】:2018-07-14 15:42:56
【问题描述】:
问题
我注意到一个矩形和一个路径之间有一个奇怪的间隙,根据坐标,它应该看起来像这样:
但看起来像这样:
它出现在 Firefox、Edge 和 IE 中,在 Chrome 中仅在某些缩放级别或添加 Stoke 时出现。
我尝试过:
- remove all white spaces (looks like the very same problem)
- add attribute
shape-rendering="crispEdges" -
move the elements closer together so that they would overlap (jsfiddle)
改善了问题,但没有解决它并引入了新问题(如笔划不匹配)。
Chrome 中的结果(v64.0.3282.140):
Firefox(v58.0.1) 中的结果:
感谢您的考虑
示例
<svg>
<g transform="matrix(1,0,0,1,60,10)">
<rect width="60" height="10" x="-30" y="0" rx="5" ry="5"></rect>
<path d="M15,10 C0,10 15,25 0,25 C-15,25 0,10 -15,10" ></path>
</g>
</svg>
<style>
g{
stroke: red;
fill: black;
}
</style>
【问题讨论】:
-
你能张贴一张“错误”的截图吗?
-
path 的 d 属性的写法很奇怪。此行 d="M 15 10 C 0 10 15 25 0 25 C -15 25 0 10 -15 10" 应为 d="M15,10 C0,10 15,25 0,25 C-15,25 0,10 -15,10"
-
感谢@SergeyRudenko 的回复,我已经在描述中发布了截图,这里是link。遗憾的是,按照您建议的方式编写路径并没有解决问题。
-
@SergeyRudenko:svg 在点规范中支持空格而不是逗号