Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrollable widget support #47

Open
hecrj opened this issue Jun 10, 2019 · 1 comment
Open

Scrollable widget support #47

hecrj opened this issue Jun 10, 2019 · 1 comment
Labels
feature New feature or request help wanted Extra attention is needed

Comments

@hecrj
Copy link
Owner

hecrj commented Jun 10, 2019

Scrolling is quite a basic feature for a UI toolkit. We need it!

I see two different approaches to tackle this:

  1. Draw the scrollable contents into a 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 fixed width and height for scrollables. However, this destroys the purpose of a responsive UI. Another approach could be simply avoid resizing the Canvas 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.
  2. Implement scissor test support for 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 in Renderer could work too.

Any other ideas?

@hecrj hecrj added feature New feature or request help wanted Extra attention is needed labels Jun 10, 2019
@hecrj hecrj mentioned this issue Jun 10, 2019
24 tasks
@hecrj hecrj pinned this issue Jun 13, 2019
@jakubDoka
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants