SVG: adding shadow filter makes straight line invisible [duplicate]

点点圈 提交于 2020-01-11 09:05:57

问题


I'm trying to add a shadow to my SVG. It works well with all 2D objects, but when same filter is applied to a straight line (either <line> or <path>), the line becomes invisible, and no shadow is added.

Demo: https://jsfiddle.net/ccj0Ldfh/1/


回答1:


Per the last paragraph here

Keyword objectBoundingBox should not be used when the geometry of the applicable element has no width or no height, such as the case of a horizontal or vertical line, even when the line has actual thickness when viewed due to having a non-zero stroke width since stroke width is ignored for bounding box calculations. When the geometry of the applicable element has no width or height and objectBoundingBox is specified, then the given effect (e.g., a gradient or a filter) will be ignored.



来源:https://stackoverflow.com/questions/36284828/svg-adding-shadow-filter-makes-straight-line-invisible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!