This PR fixes a couple issues I had when trying to use a VelloScene with Bevy's UI:
The Y-axis was flipped, so that setting any top or bottom value on the Style component caused the VelloScene to move in the opposite direction from the node
Bevy's layout system puts the transform origin at the center of the node's computed bounding box, which is awkward for a canvas-like API where you expect to be issuing draw commands with the origin at the bounding box corner.
That said, I know there are different conventions for whether the Y-origin is top or bottom, and I'm honestly not sure where Vello's origin is under normal circumstances. Let me know if you'd like to preserve a bottom-left origin for Vello drawing commands while still positioning the Vello scene so that it aligns with the Bevy node — it shouldn't be overly difficult to make that adjustment.
I haven't tested this super exhaustively, but I did verify that the original "scene" example still works as expected, and added a new "scene-ui" example for testing the changes made here. Let me know if you have any questions, concerns, or would like to see any changes!
This PR fixes a couple issues I had when trying to use a
VelloScene
with Bevy's UI:top
orbottom
value on theStyle
component caused theVelloScene
to move in the opposite direction from the nodeThat said, I know there are different conventions for whether the Y-origin is top or bottom, and I'm honestly not sure where Vello's origin is under normal circumstances. Let me know if you'd like to preserve a bottom-left origin for Vello drawing commands while still positioning the Vello scene so that it aligns with the Bevy node — it shouldn't be overly difficult to make that adjustment.
I haven't tested this super exhaustively, but I did verify that the original "scene" example still works as expected, and added a new "scene-ui" example for testing the changes made here. Let me know if you have any questions, concerns, or would like to see any changes!