问题
I'm just learning details about the SVG viewport and viewBox. What I find confusing is, that it seem counter-intuitively, despite all positive x and y coordinates going left to right and top to bottom respectively in web design, the viewBox coordinate system seems to go right to left, and bottom to top respectively?
Am I understanding this correctly, and does anybody know why this is the case.
Thanks
回答1:
This is not correct. viewBox declaration is x, y, width, height. And the origin 0,0 is top left - like most coordinate systems. If you have an example that is different, then it may be that there is a transform being applied at some level of your doc or CSS that is changing behavior.
回答2:
The penny has dropped now. Because you move the viewBox to the right and down it creates the illusion that the graphic is moving to the left and up.
来源:https://stackoverflow.com/questions/51194690/svg-viewbox-coordinates