Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is if safe to use event.layerX and event.layerY properties to get click position in svg ?

49 views
Skip to first unread message

goel...@gmail.com

unread,
Dec 16, 2018, 3:13:01 AM12/16/18
to mozilla-d...@lists.mozilla.org
We are creating some drawing board where with mouse down user can start drawing a line on svg. To get the coordinates(x,y relative to svg start point) of mousedown I am using event.offsetX and event.offsetY.

But above properties are behaving differently in firefox and chrome browser. So I decided to use event.layerX and event.layerY properties, but in Mozilla documentation it is written that it is not safe to use it.

Copied from: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/layerX

"This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future"


I also noticed a bug was raised to remove layerX and layerY from event which is raised long back in 2010, a similar defect is raised in WebKit also. In both the browser engine. Bugs are still in open state.

My question here is can I use 'event.layerX' and 'event.layerY' properties to find mouse down position? Or do we have an better way to acheive the same ?
0 new messages