...

View Full Version : SVG rendering problem (Firefox)



centenial
03-05-2009, 07:54 PM
Hi,

I haven't done much programming in SVG before. I'm hoping an expert can help me out with this problem.

I have a piece of SVG code that is supposed to render crosshairs at specific x,y coordinates on a page.

The code works fine when the SVG width and height attributes are the same values as the width and height of the SVG viewbox.

Example, this works:
<svg id="explodedHead" x="0" y="0" width="500px" height="500px" viewBox="0 0 500 500">

See:
http://207.45.186.206/_TMP/SVG/example.php
http://207.45.186.206/_TMP/SVG/example.svg


The code does NOT WORK when I make the SVG width and height attributes smaller than the SVG viewbox values.

Example, this doesn't work:
<svg id="explodedHead" x="0" y="0" width="250px" height="250px" viewBox="0 0 500 500">


See:
http://207.45.186.206/_TMP/SVG/example2.php
http://207.45.186.206/_TMP/SVG/example2.svg

Can anyone explain what I am doing wrong? Shouldn't this simply shrink the SVG canvas? I don't understand why this should effect the display of the crosshairs.

Thanks,

Alex Vincent
03-05-2009, 08:37 PM
I'm rusty on my SVG code, but it's entirely possible this is a Firefox bug.

Another possibility is that the lines are already pretty thin - could this have turned into a sub-pixel rendering problem?

centenial
03-05-2009, 08:53 PM
Another possibility is that the lines are already pretty thin - could this have turned into a sub-pixel rendering problem?

Thanks for your reply. That makes sense.

In SVG, I am setting the "stroke-width" attribute for each of the crosshairs to "1px". Is there perhaps a "minimum-stroke-width" attribute in SVG? (I tried google searching for that term, but turned up nada.) I need the crosshairs to always display at 1px, regardless of the size of the canvas. Is there a way to do this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum