SVG在“填充:无"时检测Onclick事件. [英] SVG Detect Onclick events on "fill: none"
本文介绍了SVG在“填充:无"时检测Onclick事件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用"fill:black"创建svg rect时,将调用我的on_click事件处理程序.
When I create an svg rect with "fill: black", my on_click event handler gets called.
当我将"fill:black"替换为"fill:none"时,当我在矩形内部单击时,不会调用我的事件处理程序,而仅当我单击菜单项的 border 时才调用该事件处理程序直肠.
When I replace the "fill: black" with "fill: none", my event handler is NOT called when I click inside the rect, but only called when I click on the border of the rect.
问题:我需要更改什么,以便检测到单击矩形内 的单击事件?
Question: what do I need to change so that click events are detected for clicking inside the rectangle?
推荐答案
This is controlled by the pointer-events property. Looks like you want to set it to visible
<rect pointer-events="visible" ...>
这篇关于SVG在“填充:无"时检测Onclick事件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文