Hi Julien, I don't believe that there is a simpler solution. This should work also with Firefox3. It does not work with IE+ASV3 since ASV3 does not support getScreenCTM(). Holger Will has a workaround in such a case, which you can find at http://tech.groups.yahoo.com/group/svg-developers/message/50789 It is complicated but it worked fine for me. Cheers, Samy
--- In svg-developers@yahoogroups.com, "Julien Reichel" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I found a solution using the state of the art SVG 1.2 features (works in > opera and in SpinetiX HMD). But I will be happy to learn of a more > portable version. > > Here is the 1.2 SVGT version: > > Hi all, > > I found a solution using the state of the art SVG 1.,2 features (works > in opera and in SpinetiX HMD). But I will be happy to learn of a more > portable version. > > Here is the 1.2 SVGT version: > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" > viewBox="0 0 800 600" version="1.2" > > > <rect x="0" y="0" width="800" height="600" id="back"> > <handler type="application/ecmascript" ev:event="mousemove"> > > var docMatrix=document.getElementById("back").getScreenCTM(); > cursor=document.getElementById("cursor"); > var pt=document.documentElement.createSVGPoint(); > pt.x=evt.clientX; > pt.y=evt.clientY; > pt=pt.matrixTransform(docMatrix.inverse()); > cursor.setAttribute("transform" , "translate("+pt.x+","+pt.y+")"); > > </handler> > </rect> > > <g xml:id="cursor"> > <rect x="-5" y="-5" width="10" height="10" fill="red" stroke="blue"/> > </g> > </svg> > > ________________________________ > > From: svg-developers@yahoogroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Julien Reichel > Sent: 29 August 2008 13:57 > To: svg-developers@yahoogroups.com > Subject: [svg-developers] Showing the mouse position > > > > Hi, > > I'm trying to do a small example showing the mouse position (se > bellow). > I want my image to scale on all the window (that's why I use the > width="100%" height="100%"). > > However, as the displaying size is no longer equal to the > viewBox of my > SVG file, the cursor's position depends on the size of the > window :-( > > I'm sure there must be a simple solution to solve this problem, > but > right now, I cannot find it... > > Any help ? > > Julien > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <svg xmlns="http://www.w3.org/2000/svg > <http://www.w3.org/2000/svg> " width="100%" height="100%" > viewBox="0 0 800 600" > > <script> > <![CDATA[ > function move(evt) { > cursor=evt.target.ownerDocument.getElementById("cursor"); > cursor.setAttributeNS(null, "transform" , > "translate("+evt.clientX+","+evt.clientY+")"); > } > ]]> > </script> > <rect x="0" y="0" width="800" height="600" > onmousemove="move(evt)" /> > <g id="cursor"> > <rect x="-5" y="-5" width="10" height="10" fill="red" > stroke="blue"/> > </g> > </svg> > ---------------------------------------------------------- > > Julien Reichel, PhD > Technology Architect, SpinetiX S.A. > PSE-C, CH-1015, Lausanne, Switzerland > > Tel: +41 (0) 21 693 89 81 > Mail: [EMAIL PROTECTED] > <mailto:julien.reichel%40spinetix.com> > Get Information : http://www.spinetix.com > <http://www.spinetix.com> > > ---------------------------------------------------------- > ------------------------------------ ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/