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

Painter and ScrollViews #25

Closed
migueldeicaza opened this issue Mar 15, 2021 · 2 comments
Closed

Painter and ScrollViews #25

migueldeicaza opened this issue Mar 15, 2021 · 2 comments

Comments

@migueldeicaza
Copy link
Owner

migueldeicaza commented Mar 15, 2021

The current painter is useful to track the cursor position, but it could be augmented to support clipping, and it could be augmented to solve the problem with ScrollView, to allow arbitrary controls to be embedded into a ScrollView and behave the same way a control works inside a UIScrollView - that is, they do not know that they are being scrolled.

I have a patch that passes a "painter' argument to every redraw function, and in ScrollView, a new ContentView that can pass a Painter that has been altered to deal with a content offset (drawing before this point does nothing).

For this to work though, it is not enough for the top-level control to take a modifier painter, but Painter objects need to be created with a parent link, so rather than just calling Painter (from: view), it would need to use Painter (from: view, on: currentPainter).

That is one option.

Another option would be to make the Painter method allocate a buffer for the bounds, and upon completion of the rendering, it would copy the data to the right location. This has the advantage that we could properly clip everything.

Still thinking about this.

This patch contains the wiring up of Painter, but does not do the double buffering described here:

https://gist.github.com/migueldeicaza/954c2c64be08d8bb7849f2374759e25c

That would also make it uglier to debug with sync

@migueldeicaza
Copy link
Owner Author

Ok, this code is now in a branch.

Some methods in Painter are still using the old style rendering, that should be fixed as well.

@migueldeicaza
Copy link
Owner Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant