JavaScript and SVG: how do you increase the clickable area for an onClick event?

后端 未结 2 1812
难免孤独
难免孤独 2021-01-12 04:09

My script draws lines on the screen at a stroke-width of 3. The size of lines are ideal (visually) but they aren\'t very easy to click.

As a rough example:

相关标签:
2条回答
  • 2021-01-12 04:18

    A variation on the above answer. For a cool selection effect group each thin line and transparent line combo in a group with the thin line on top. Set the onclick to the group and then animate the transparency of the thick line in your onclick.

    0 讨论(0)
  • 2021-01-12 04:35

    For each line, try drawing a transparent line on top of it with a larger stroke width, and set the onclick on that.

    0 讨论(0)
提交回复
热议问题