svg - How to determine mouse's position is close enough to a path? -
i'm developing chart d3.js. there's functionality don't have clue how implement: have polyline on chart, , want highlight it(make bolder, turn other color) when mouse close enough point of polyline.
i don't know if there's built in function in d3 determine if mouse close me(the svg element). if not, how implement this?
assume above functionality ready, how make highlighted polyline can dragged when mouse close line not on line?
try making each point have large border 5px, make border transparent , use background-clip property ensure background not extend border.
then can use mouseover actions , trigger effects [change color, make larger] on cicles.
this way circles same size have hidden border of 5px respond mouseover events. hovering close circle not touching trigger events since touching transparent border.
hope helps.
Comments
Post a Comment