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.
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.
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'sinsertBefore()
, 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.