W3C home > Mailing lists > Public > www-svg@w3.org > April 2009

units other than pixels very unprecise? (how should 'top' width/height larger than screen be handled?)

From: Ruud Steltenpool <svg@steltenpower.com>
Date: Mon, 20 Apr 2009 02:11:57 +0200
Message-ID: <49EBBDCD.3060301@steltenpower.com>
To: www-svg@w3.org
According to this:

<svg xmlns="http://www.w3.org/2000/svg" onclick="calculate()">
<script type="text/ecmascript"> <![CDATA[
     function calculate(evt) {
		bb=document.getElementById("rect").getBBox();

		rwi=1;
		rwp=bb.width;
		swp=screen.width;
		swi=swp/rwp*rwi;

		rhi=1;
		rhp=bb.height;
		shp=screen.height;
		shi=shp/rhp*rhi;
		
		sdi=Math.sqrt(swi*swi+shi*shi);

		blah="rect\n";
		blah+=rwi+"x"+rhi+"(inch,given)\n";
		blah+=rwp+"x"+rhp+"(pixels,queried)\n";
		blah+="\n";

		blah+="screen\n";
		blah+=swp+"x"+shp+"(pixels,queried)\n";
		blah+=swi+"x"+shi+"(inch,calculated)\n";
		blah+="diagonal= "+sdi+" inch\n";
		blah+="(ERROR: in my case a strong exaggeration)";
		blah+="\n";
		blah+="\n";
		
		
		blah+="Without this ERROR i could of course calculate the viewBox i 
need in combination with width='100%' and height='100%' in order to 
scale any drawing to the prefered physical size\n";
		blah+="\n";
		
		blah+="This ERROR of course also means it's very unprecise/unwise to 
use units (other than pixels) in general";
		
		alert(blah);
     }
   ]]> </script>
<rect id="rect" width="1in" height="1in"/>
</svg>
Received on Monday, 20 April 2009 00:12:52 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:42 GMT