If you try an example from attached file (an html one), you will be able
to drag-n-drop blue circle while you did not scroll view port. But if
you scroll viewport to see green ball, you will not be able to drag it.
clientX and clientY are given as if the image were not scrolled at all,
and the circle immediately moves to the top of the image...
It seems to me that I should add dx and dy of scrollbars, to get real
coordinates. But I do not know where to get them.
Can you please help me with this sample?
Oups, list engine have deleted attached svg file...
these files can be found here:
http://lj.shaplov.ru/2009/svg/problem.svg
http://lj.shaplov.ru/2009/svg/problem.html
pageX is relative to the top of page, regardless of the browser scrolling.
Beware that the AdobeSVG Viewer Pluginarea is not "informed" by the
scrolling, so there clientx is not changed.
var mousePosX;
var mousePosY;
if (evt.pageX || evt.pageY) {
//code for native SVG. pageX based on the full XHTML Document
mousePosX = evt.pageX;
mousePosY = evt.pageY;
}else{
//code for plugin. clientX is based on the Plugin area, without browser
scrolling sideeffects
mousePosX = evt.clientX;
mousePosY = evt.clientY;
}
--
best regards
Holger
Thanks! You've made my live happier...
BTW. I did not find pageX in SVG spec... It is mozilla specific
implementation, or what? Is it described somewhere?
It is available in Opera, Webkit and Mozilla.
It is described in a Working Draft:
http://www.w3.org/TR/cssom-view/
According to https://developer.mozilla.org/en/DOM/event.pageX
it is "Not part of any public standard."
--
best regards
Holger Jeromin