Open hecrj opened 5 years ago
Triangles can be cropped to fit the rectangle. If you are collecting all vertices into batch and drawing them then you can just pass them trough cropping algorithm that will calculate new vertex and texture positions based of view rectangle. Assuming all objects inside ui can be represented by rectangles (AABB) when being drawn.
Scrolling is quite a basic feature for a UI toolkit. We need it!
I see two different approaches to tackle this:
Canvas
. The issue is that we would need to recreate it once the scrollable changes dimensions. We could circumvent this initially by forcing users to set a fixedwidth
andheight
for scrollables. However, this destroys the purpose of a responsive UI. Another approach could be simply avoid resizing theCanvas
every frame while resizes happen, and only do it at a specific rate. Although this would cause the UI to not resize smoothly, it could be good enough for now.Target
. This sounds way more elegant, but it entails more work as we will have to add scissor support for all the current pipelines (quads and font rendering). It should be doable, but it needs to be done carefully.In both scenarios,
Widget::draw
definition will probably need to change to improve composability and recursive draws (scrollables inside scrollables). Although I think a tree-like data structure stored inRenderer
could work too.Any other ideas?