SVG coordinates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • google@durandal.nl

    #1

    SVG coordinates

    Hello,

    Using ECMA script within an SVG document i'm looking for
    a way to display an overlay window (rectangle) that follows
    the mouse cursor an shows some information.

    It boils down to getting the coordinates of the mouse
    cursor in the SVG document. While evt.clientX/Y will give
    you the pixel coordinates relative to the topleft of the SVG
    document, it does not, however, has the same scale or position
    of that document's coordinates.

    In short; evt.clientX/Y (and evt.screenX/Y) give pixel coordinates,
    not document coordinates, and to have a rectangle follow the mouse i
    need to draw it in document coordinates.
    Any help?

    (Using Adobe SVG viewer 3.0 and latest IE)

  • Jim Ley

    #2
    Re: SVG coordinates

    On 2 Dec 2004 03:03:38 -0800, google@durandal .nl wrote:
    [color=blue]
    >In short; evt.clientX/Y (and evt.screenX/Y) give pixel coordinates,
    >not document coordinates, and to have a rectangle follow the mouse i
    >need to draw it in document coordinates.[/color]

    You use viewBox.js from Kevin Lindsey



    (or the equivalent maths simplified to your viewBox)

    Jim.

    Comment

    Working...