I’m playing around with the RaphaelJS library, and I notice that it’s very pixel-oriented. I’d like to draw something that scales with the viewport. Is it possible to redefine the canvas coordinate system to run from 0 to 1, so if I draw a circle centered at [0.5, 0.5], it remains in the middle of its container even as the container’s size changes?
This may be more of an SVG/VML question, since even if Raphael has no way to do this, I can always access the underlying svg element directly.
I don’t know if this is the best answer, but I found a way to get some of what I was looking for. If you ignore the width/height parameters, or use ‘100%’, then the setViewBox command can be used to set up your own coordinate system.
The problem of course is that this scales everything, including strokes, backgrounds, etc. This makes it difficult to have things like stroke-widths other than 1px.