Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SVG rendering problem (Firefox)

    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,

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    New Coder
    Join Date
    May 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Alex Vincent View Post
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •