RE: [svg-developers] Re: showing full svg content whithout calculating extents
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of Alireza
Sent: Friday, April 06, 2012 9:31 AM
Subject: [svg-developers] Re: showing full svg content whithout calculating extents
Thanks, I wished I could find a tag or attribute for this but this is also useful.
--- In firstname.lastname@example.org <mailto:svg-developers%40yahoogroups.com> , yannick.bochatay@... wrote:
> if all your shapes are included in a g element, you can use the getBBox method on this node to get the dimensions.
> In your example :
> ----- Mail original -----
> De: "Alireza" <ahmadi_rad@...>
> Ã€: email@example.com <mailto:svg-developers%40yahoogroups.com>
> EnvoyÃ©: Jeudi 5 Avril 2012 10:19:19
> Objet: [svg-developers] showing full svg content whithout calculating extents
> I need help for finding extents of an svg drawing. Please take a look at this example:
> <svg id="SVG1" width="5cm" height="5cm" viewBox="0 -100 200 200">
> <g id="G2">
> <line x1="0" y1="0" x2="100" y2="100" stroke="blue"/>
> <line x1="0" y1="0" x2="0" y2="100" stroke="blue"/>
> <line x1="0" y1="0" x2="100" y2="0" stroke="blue"/>
> <line x1="0" y1="0" x2="100" y2="-100" stroke="blue"/>
> For this sample it was easy to understand that viewBox="0 -100 200 200" will fit the whole drawing. But in my real world application this will not be so easy to calculate this. And without this viewbox or with incorrect calculations, at least a part of drawing will not be shown which is not desirable.
> I want to show the whole drawing in svg without getting involved in calculating the extents. Something like zoom extents in aoutocad. could you please help?
[Non-text portions of this message have been removed]