Hi Helder,

When you figure it out, please let me know (or better yet add it somewhere in 
http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html :)

I've just typically been lazy and drawn a <rect width="100%" height="100%" 
x="0%" y="0%" fill="none" /> and then measured it using getBBox, but that's 
both clunky seeming and maybe won't work right with viewports. 

cheers
David

----- Original Message ----- 
  From: heldermagalhaes 
  To: svg-developers@yahoogroups.com 
  Sent: Tuesday, August 10, 2010 1:08 PM
  Subject: [svg-developers] Determining viewport size


    
  Hi everyone,

  It seems a simple question, although I'm not being able to find an easy 
answer: how can one determine the actual (screen) viewport size?

  I remember using innerWidth/innerHeight in the past (window object 
properties) but AFAIK these are not standard: at least, "Window size and 
position information" isn't addressed in the current Window Object 
specification [1]. Also, for example, these properties aren't supported by 
Batik [2] and probably other "pure" SVG implementations. Nevertheless, they 
seem to be supported by every Web browser that I'm aware of, so could this be 
seen as a Batik et. al. limitation? (That is, could one expect the properties 
to be made standard in a short-to-medium term?)

  One could also try getting limit coordinates (using a combination of the 
"width"/"height"/"viewBox" properties) and later do some maths to transform 
them to screen coordinates but intuitively this will fail unless 
"preserveAspectRatio" [3] is set to "none" (which would force the whole viewbox 
to be used but isn't often used as the graphics will appear stretched).

  Please shed some light into this matter and/or point me in the right 
direction: maybe I'm just missing something... ;-)

  Cheers,
  Helder

  [1] http://www.w3.org/TR/Window/
  [2] http://xmlgraphics.apache.org/batik/status.html#ecmascript
  [3] http://www.w3.org/TR/SVG11/coords.html#PreserveAspectRatioAttribute



  

[Non-text portions of this message have been removed]



------------------------------------

-----
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-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:
    svg-developers-dig...@yahoogroups.com 
    svg-developers-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    svg-developers-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to