Skip to content

Illustration centering on anchor#127

Open
asl97 wants to merge 2 commits into
metafizzy:masterfrom
asl97:patch-2
Open

Illustration centering on anchor#127
asl97 wants to merge 2 commits into
metafizzy:masterfrom
asl97:patch-2

Conversation

@asl97
Copy link
Copy Markdown

@asl97 asl97 commented May 10, 2026

I had this idea of allowing an anchor to be passed to the Illustration's centered instead of just true.

Turns out shape stores and reuse it's own SVG elements, probably for performance, browser limitation of not being able to have same element at multiple location.

Resulting in model not liking to get rendered multiple times, any previously rendered seem to get removed when rendering to a different Illustration instance.

Worked around the issue using this.element.innerHTML = this.element.innerHTML to basically make the SVGs elements be a copy.

Demo https://asl97.github.io/zdog/demos/centered/

asl97 added 2 commits May 10, 2026 20:35
Note: limitation of only being able to render a shape to one SVG Illustration at any one time
for working around limitation of zdog only being able to render a shape to one SVG instance at any one time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant