- From: Robert O'Callahan <robert@ocallahan.org>
- Date: Mon, 30 Jun 2008 16:40:55 +1200
- To: www-svg <www-svg@w3.org>
- Message-ID: <11e306600806292140u6558b8ddmdd33591722daf541@mail.gmail.com>
Currently, SVG units can express a coordinate N pixels from the top or left edge of the viewport, but not from the right or bottom edge (unless N is 0, in which case I can use %). So it's easy to draw a 10px-wide rectangle along the left edge of the viewport, but not the right edge. I can work around this limitation in some cases by introducing an <svg> container. For example, I can actually draw a 10px wide rectangle along the right edge using <svg ...> <svg x="100%" style="overflow:visible"> <rect x="-10" width="10" y="0" height="100%"/> </svg> </svg> However, as far as I can tell there is no way to use this to draw, say, a rectangle inset from the viewport by 10px on each side. (And of course it's very ugly.) A very simple extension would be to allow length values like "50%-10". This is necessarily trivial to implement since length interpretation already requires support for viewport percentages and user-space units; this just combines them into a single value. An important use-case for this is "nine-grid" image stretching (see e.g. http://msdn.microsoft.com/en-us/library/bb189722.aspx). It would be very useful if SVG images supported this, for example for use as background images for flexible HTML content. Of course, SVG direly needs a real layout mechanism. But this is a very small tweak that would provide a great deal of value. Rob -- "He was pierced for our transgressions, he was crushed for our iniquities; the punishment that brought us peace was upon him, and by his wounds we are healed. We all, like sheep, have gone astray, each of us has turned to his own way; and the LORD has laid on him the iniquity of us all." [Isaiah 53:5-6]
Received on Monday, 30 June 2008 04:41:32 UTC