- From: Arnold, Curt <Curt.Arnold@hyprotech.com>
- Date: Fri, 11 Jan 2002 17:27:06 -0700
- To: "'www-svg@w3.org'" <www-svg@w3.org>
- Cc: "'www-dom@w3.org'" <www-dom@w3.org>
Sorry, when you had mentioned "viewport" coordinates, I had interpreted that as the user coordinate system established by the viewBox attribute on the <svg> element. For others that may be as confused as I was, the following SVG document will display the values from clientX and clientY that will NOT be in coordinate space established by the viewBox (that is between [1000,1000] and [2000,2000]). The coordinates from the MouseEvent have to be transformed back into the user coordinate space by nasty, error prone script code before you have coordinates that you could do anything with. <svg xmlns="http://www.w3.org/2000/svg" viewBox="1000 1000 1000 1000"> <defs> <script type="text/ecmascript"> var textNode = document.getElementsByTagName("text").item(0).firstChild; function mousemove(evt) { textNode.nodeValue = "clientX=" + evt.clientX.toString() + " clientY=" + evt.clientY.toString(); } </script> </defs> <rect x="1000" y="1000" height="1000" width="1000" fill="beige" onmousemove="mousemove(evt)"/> <text y="1500" x="1100" fill="red" font-size="100">No event yet</text> </svg> ---------- The only situation that I could see the note in Appendix B5 having any observable affect in the still hypothetical (or at least experimental) case of XHTML documents containing <svg> elements. Without a standard method to convert clientX and clientY into user coordinates, the sentence could be useful since it would make it tractable to convert client coordinates since you could find the outermost containing <svg> element, find its width, height, viewBox and refine all those down to coordinates that you could use to modify coordinates or add new elements. However, if you dropped the sentence in B5 and added a convertClientXY() method to SVGElement (or something equivalent), you would not adversely affect deployed SVG documents, would get consistent clientX and clientY values as a user moused over intermixed XHTML and SVG content and SVG authors would have a simple way of converting client coordinates into user coordinates without jumping through hoops.
Received on Friday, 11 January 2002 19:27:37 UTC