javascript - Is there a way to check if specific point (X,Y) is in the SVG element? -


what need understand if mouse leaves svg object (path, i.e not rectangular - can't use offset, not circular - can't use radius , center position, etc. ). can not use mouse leave/enter events because have pointer mouse above elements. can't use elementfrompoint - because gives top layer element.

so question: there way understand if coordinates (x,y) in specific element $("#element").

upd:

i uploaded current code website http://pekap.co/example/ didn't create jsfiddle because have svg object ebmed. there can find js, svg object use, etc.

if go svg object changes color , pointer appears (orange circle). goal change color of svg area whenever leave it/ enter , display orange circle under mouse inside svg area.

whereas can accomplish on 1 of goals (either 1 different code)

upd 2.

erik dahlström gave perfect solution me: set pointer-events none in css. go now, make day perfect great if there way detect when part of circle out of svg area.

i'm not sure follow mean, pointer little circle follows mouse?

if so, make circle have pointer-events: none , "transparent" mouse events. note webkit/safari/chrome/blink doesn't yet support mouseenter , mouseleave you'll need scriptbased workaround (not sure if d3 already).

it should possible solution based on using css :hover rule on path element. set property value on hover, , check getcomputedstyle property set on path element.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -