Hi All SVG Pro’s,

Background: I’m creating circular shaped images using SVG. Sometimes the images 
seem to get slightly cut off. Maybe because part of the stroke overlaps the 0 
point? Anyway, I decided I’d add a non-drawable margin around the image. Say 
around 4 pixels or so.

The only way I could get it to reliably work is to define both the viewbox and 
the viewport. Usually defining the viewport is enough.

So for example, if the viewport had a height and width of 600 pixels then…

svg_width:=600
svg_height:=600
$_offset:=4

SVG_SET_DIMENSIONS ($domSvg;$svg_width;$svg_height;"px”)

In order to get this to work without cutting off edges I had to set the viewbox 
as follows:

$viewbox_width:=$svg_width+($_offset*2) 
$viewbox_height:=$svg_height+($_offset*2) 

$viewbox_x:=-$_offset
$viewbox_y:=-$_offset
$viewbox_mode:="true"  // is same as xMinYMin

SVG_SET_VIEWBOX 
($domSvg;$viewbox_x;$viewbox_y;$viewbox_width;$viewbox_height;$viewbox_mode)

So to get this to work I had to subtract the offset from the view box x and y. 
And I had to add the offset multiplied by two to the view box width and height.

So my question is…

Is this the best way? Is this even correct?

I’m looking for the most reliable and effective approach to managing an svg 
image workspace.

Hope that makes sense?

Hope someone has had to deal with this issues!

Appreciate you all,
John…



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to