Menu

viewBox and preserveAspectRatio

Help
Kaupo Palo
2014-06-17
2014-07-06
  • Kaupo Palo

    Kaupo Palo - 2014-06-17

    I would use viewBox and preserveAspectRatio="none" attributes of svg root element for defining a coordinate system.

    However I cannot get this work. If preserveAspectRatio="none" then x-min and y-min of viewBox are ignored:

    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="500" height="500" viewBox="-5 -5 10 20" preserveAspectRatio="none">
    <rect x="-5" y="-5" width="10" height="20" fill="none" stroke="blue" stroke-width="0.1" />
    </svg>
    

    In this example the rectangle should be fully on the image.

    If I write preserveAspectRatio="xMinYMin none" then it uses the corner coordinates but unfortunately renders with fixed aspect ratio.

     
  • NtAlex

    NtAlex - 2014-07-06

    fixed in wxSVG 1.4.2

     

Log in to post a comment.