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

Use index instead of anchor for Renderer.insert function #10

Open
berendkleinhaneveld opened this issue Mar 10, 2022 · 1 comment
Open

Comments

@berendkleinhaneveld
Copy link
Collaborator

I want to propose to change the API of Renderer.insert to take an optional position instead of an anchor object. This might simplify the reconciliation code a bit and save some computations (both in reconciliation and commit phases).

The API was just copied/inspired by Vue's custom renderer API, but using an anchor instead of an index makes things awfully complicated... I guess Vue choose this API because of JavaScript's insertBefore(), but we don't necessarily need it ourselves?
Inserting items in PySide/Qt works with indices and the API for Pygfx can be easily updated to work with indices instead as well.

@Korijn
Copy link
Collaborator

Korijn commented Mar 10, 2022

I mean.. go right ahead. Depending on what's easiest for you, you can also consider supporting both; the anchor can be None, an index, or an anchor object.

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

2 participants