Hi,
 
To show mouse coordinates on screen, I use following lines;
 
var X = x0 + (evt.getClientX() - svgroot.currentTranslate.x)*(vboxW/
(svgW*svgroot.currentScale));
var Y = -(y0 + (evt.getClientY() - svgroot.currentTranslate.y)*(vboxH/
(svgH*svgroot.currentScale)));
var point = String(X).substr(0,8) + " , " + String(Y).substr(0,8) 
+ " ";
var position =  svgdoc.getElementById("position");    
position.getFirstChild().setData(point);
 
in the above lines,
 
svgdoc = evt.target.getOwnerDocument();
svgroot = svgdoc.getDocumentElement();
var vbox = (svgroot.getAttribute("viewBox")).split(' ');
x0 = parseFloat(vbox[0]);
y0 = parseFloat(vbox[1]);
vboxW = parseFloat(vbox[2]);
vboxH = parseFloat(vbox[3]);
svgW = parseFloat(svgroot.getAttribute("width"));
svgH = parseFloat(svgroot.getAttribute("height"));
 
but it doens't work correctly. X coordinates show almost correct, but 
Y coordinate is wrong. How can I fix Y coordinates?
 
Thanks...
 
*********************** my svg file is ***************************
 
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
                     "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd
">
 
<svg width="530" height="350" viewBox="28814.40 -30823.94 102.84 
85.12" onload="on_load(evt)" >
 <g id="imarcap" onmousemove="DoOnMouseMove(evt)">
  <g onclick="mapclick(evt)" style="stroke:red;stroke-
width:.7;opacity:0.5" >
   <line x1="28909.80" y1="-30806.73" x2="28917.24" y2="-30798.73"/>
   <line x1="28917.24" y1="-30798.73" x2="28913.09" y2="-30791.22"/>
   <line x1="28913.09" y1="-30791.22" x2="28912.22" y2="-30790.04"/>
   <line x1="28912.22" y1="-30790.04" x2="28908.31" y2="-30784.73"/>
   <line x1="28908.31" y1="-30784.73" x2="28903.91" y2="-30779.26"/>
   <line x1="28903.91" y1="-30779.26" x2="28901.22" y2="-30773.10"/>
   <line x1="28901.22" y1="-30773.10" x2="28899.17" y2="-30768.40"/>
   <line x1="28899.17" y1="-30768.40" x2="28895.29" y2="-30770.70"/>
   <line x1="28895.29" y1="-30770.70" x2="28889.66" y2="-30774.04"/>
   <line x1="28889.66" y1="-30774.04" x2="28882.59" y2="-30778.23"/>
   <line x1="28882.59" y1="-30778.23" x2="28880.63" y2="-30779.70"/>
   <line x1="28880.63" y1="-30779.70" x2="28871.80" y2="-30786.34"/>
   <line x1="28871.80" y1="-30786.34" x2="28871.09" y2="-30786.87"/>
   <line x1="28871.09" y1="-30786.87" x2="28863.03" y2="-30795.36"/>
   <line x1="28863.03" y1="-30795.36" x2="28888.78" y2="-30822.62"/>
   <line x1="28888.78" y1="-30822.62" x2="28909.80" y2="-30806.73"/>
  </g>
  <g onclick="mapclick(evt)" style="stroke:black; stroke-width:.35; 
fill:black">
   <circle cx='28909.80' cy='-30806.73' r='0.35' />
   <circle cx='28917.24' cy='-30798.73' r='0.35' />
   <circle cx='28913.09' cy='-30791.22' r='0.35' />
   <circle cx='28912.22' cy='-30790.04' r='0.35' />
   <circle cx='28908.31' cy='-30784.73' r='0.35' />
   <circle cx='28903.91' cy='-30779.26' r='0.35' />
   <circle cx='28901.22' cy='-30773.10' r='0.35' />
   <circle cx='28899.17' cy='-30768.40' r='0.35' />
   <circle cx='28895.29' cy='-30770.70' r='0.35' />
   <circle cx='28889.66' cy='-30774.04' r='0.35' />
   <circle cx='28882.59' cy='-30778.23' r='0.35' />
   <circle cx='28880.63' cy='-30779.70' r='0.35' />
   <circle cx='28871.80' cy='-30786.34' r='0.35' />
   <circle cx='28871.09' cy='-30786.87' r='0.35' />
   <circle cx='28863.03' cy='-30795.36' r='0.35' />
   <circle cx='28888.78' cy='-30822.62' r='0.35' />
  </g>  
  <text x="28894.24" y="-30786.63" font-size="7" font-
family="Verdana" fill="red" >34</text>
  <g onclick="mapclick(evt)" style="stroke:blue;stroke-
width:1.5;opacity:0.5" >
   <line x1="28902.90" y1="-30823.94" x2="28907.65" y2="-30821.14"/>
   <line x1="28907.65" y1="-30821.14" x2="28913.35" y2="-30782.60"/>
   <line x1="28913.35" y1="-30782.60" x2="28909.26" y2="-30776.91"/>
   <line x1="28909.26" y1="-30776.91" x2="28882.28" y2="-30765.62"/>
   <line x1="28882.28" y1="-30765.62" x2="28855.09" y2="-30754.25"/>
   <line x1="28855.09" y1="-30754.25" x2="28818.21" y2="-30738.82"/>
   <line x1="28818.21" y1="-30738.82" x2="28814.56" y2="-30740.59"/>
   <line x1="28814.56" y1="-30740.59" x2="28814.40" y2="-30773.92"/>
   <line x1="28814.40" y1="-30773.92" x2="28815.45" y2="-30775.24"/>
   <line x1="28815.45" y1="-30775.24" x2="28836.78" y2="-30787.12"/>
   <line x1="28836.78" y1="-30787.12" x2="28862.38" y2="-30801.37"/>
   <line x1="28862.38" y1="-30801.37" x2="28902.90" y2="-30823.94"/>  
  </g>
  <g onclick="mapclick(evt)" style='stroke:black; stroke-width:.50; 
fill:white'>
   <circle cx='28902.90' cy='-30823.94' r='0.75' />
   <circle cx='28907.65' cy='-30821.14' r='0.75' />
   <circle cx='28913.35' cy='-30782.60' r='0.75' />
   <circle cx='28909.26' cy='-30776.91' r='0.75' />
   <circle cx='28882.28' cy='-30765.62' r='0.75' />
   <circle cx='28855.09' cy='-30754.25' r='0.75' />
   <circle cx='28818.21' cy='-30738.82' r='0.75' />
   <circle cx='28814.56' cy='-30740.59' r='0.75' />
   <circle cx='28814.40' cy='-30773.92' r='0.75' />
   <circle cx='28815.45' cy='-30775.24' r='0.75' />
   <circle cx='28836.78' cy='-30787.12' r='0.75' />
   <circle cx='28862.38' cy='-30801.37' r='0.75' />
  </g>
  <text x="28861.03" y="-30778.46" font-size="8" font-
family="Verdana" fill="black" >121</text>
 </g>
</svg>






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

<*> 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/
 



Reply via email to