← Back to context

Comment by __jonas

2 years ago

Interesting! I am not too annoyed by the coordinate system with flipped y-axis, but I understand that other graphics APIs handle it differently, the vertical-first order I really don't get though.

Out of curiosity, I just briefly looked at the OpenGL 1.0 specification from 1994 [1] and it seems it is also taking coordinates in the order (x,y), I wonder why CSS then decided to go the other way.

[1] https://registry.khronos.org/OpenGL/specs/gl/glspec10.pdf

Some drawing systems take coordinates in x,y but the origin is top left. Ascending coordinates go down and right. Then other systems have an origin at the bottom left so ascending coordinates go right and up. There's good reasons for both depending on the context and nature of the drawing.

  • > Some drawing systems take coordinates in x,y but the origin is top left

    Right, as I said, top left coordinate system makes sense to me (like in the browser), so does bottom left (like in OpenGL) it's just the fact that CSS expects (y,x) not (x,y) for margins and padding short-hands, regardless of the coordinate system that confuses me.

    • >top left coordinate system makes sense to me

      top left is where reading is assumed to start in Western societies, maybe other systems have the same because of the natural feeling this inspires.

> OpenGL 1.0

Not quite what I had in mind particularly because opengl was an abstraction layer designed to begin to resolve these kinds of issues in a more domain-oriented way. Go further back I’m thinking more about the 8-bit generation which is … yeah 80s

I don’t know why CSS didn’t try to resolve the issue too, just alluding to why it might have been at odds in the first place.