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

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

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. Replies:
    1
    Views:
    22,181
    Jim Gibson
    Nov 4, 2003
  2. Berk Birand

    Read coordinates

    Berk Birand, Mar 6, 2004, in forum: Perl
    Replies:
    2
    Views:
    669
    Berk Birand
    Mar 7, 2004
  3. Arne Nordmann
    Replies:
    0
    Views:
    690
    Arne Nordmann
    Jun 28, 2004
  4. Mardagg
    Replies:
    0
    Views:
    1,008
    Mardagg
    May 12, 2006
  5. Mardagg
    Replies:
    0
    Views:
    856
    Mardagg
    May 12, 2006
  6. Suresh  Kumar
    Replies:
    0
    Views:
    793
    Suresh Kumar
    Jul 3, 2003
  7. Suresh  Kumar
    Replies:
    0
    Views:
    727
    Suresh Kumar
    Jul 4, 2003
  8. milof83

    svg to svg saving problem

    milof83, Aug 18, 2006, in forum: Java
    Replies:
    1
    Views:
    1,187
    Roland de Ruiter
    Aug 18, 2006
Loading...