SVG coordinates

Discussion in 'Javascript' started by google@durandal.nl, Dec 2, 2004.

  1. Guest

    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)
    , Dec 2, 2004
    #1
    1. Advertising

  2. Jim Ley Guest

    On 2 Dec 2004 03:03:38 -0800, wrote:

    >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.


    You use viewBox.js from Kevin Lindsey

    http://www.kevlindev.com/gui/utilities/viewbox/

    (or the equivalent maths simplified to your viewBox)

    Jim.
    Jim Ley, Dec 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arne Nordmann
    Replies:
    0
    Views:
    515
    Arne Nordmann
    Jun 28, 2004
  2. Mardagg
    Replies:
    0
    Views:
    796
    Mardagg
    May 12, 2006
  3. Mardagg
    Replies:
    0
    Views:
    649
    Mardagg
    May 12, 2006
  4. Suresh  Kumar
    Replies:
    0
    Views:
    580
    Suresh Kumar
    Jul 3, 2003
  5. Suresh  Kumar
    Replies:
    0
    Views:
    507
    Suresh Kumar
    Jul 4, 2003
Loading...

Share This Page