- From: ½É±ÔÂù <sim@multics.co.kr>
- Date: Tue, 22 Aug 2000 18:04:56 +0900
- To: <www-svg@w3.org>
Hi, all I have a question onmouse event and coordinates. I want to get viewbox coordinate where on mouse clicked in SVG documenton. In below example . I want to get coordinate of point on clicked and to add 'cronenode' in that point. but, funtion "evt.getClientX()", "evt.getClientY()" returns viewport coordinates, not user coordinates of SVGDOC. How to get vewbox coodinates in svg document? <?xml version = "1.0" standalone = "no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"> <svg width = "500px" height="800px" viewBox="-32000 -25600 64000 50000"> function DoOnclick(evt) { var dx,dy; var objnode; var contents; var svgdoc =getSVGDocument(evt.getTarget()); dx=evt.getClientX(); dy=evt.getClientY(); contents = svgdoc.getElementById ('my'); var crnode = newnode.cloneNode(true); crnode.setAttribute ('x', dx); crnode.setAttribute ('y', dy); contents.appendChild (crnode); } ... <rect style="fill:#ebebeb;stroke:#ebebeb" x="-31872" y="-25344" width="63744" height="50944"/> ... </svg>
Received on Tuesday, 22 August 2000 05:08:23 UTC