metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
https://zzz.dog
10.38k stars 394 forks source link

AddTo can't change after creation of Zdog element #98

Closed gemgames closed 4 years ago

gemgames commented 4 years ago

If anyone knows how to change "Addto" to add a group to something, please let me know. I am one of the guys working on their own Zdog Editor (I have a beta repository) and need this.

Test case: https://codepen.io/gemgames/pen/qBbKjGK

mootari commented 4 years ago

Once an element has been instantiated, you need to call .addChild() on the new parent to reparent the element.

By the way: I highly recommend that you familiarize yourself with the zdog internals, starting with Anchor and Shape. You might also be interested in this collection of Zdog helpers.

gregja commented 4 years ago

Hi @gemgames , I confirm what @mootari says, specially for the Anchor which is very useful if you want to add dynamically some items to an existing shape. @mootari : your Zdog helpers are great, very good job. I didn't see a repo about it on you github account, do you plan to create one ?

mootari commented 4 years ago

I didn't see a repo about it on you github account, do you plan to create one ?

No, I don't think there's enough code to justify the effort. But I've just added an ISC license to the notebook.

gemgames commented 4 years ago

Thank you!