metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG

Home Page:https://zzz.dog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't change zoom after creation (SVG)

jacasch opened this issue · comments

When changing the zoom of an illustration (illo.zoom) and then updating the render graph, the zoom value is ignored. It just stays at the initial value.
Weirdly this doesnt happen on codepen, just on local websites where zdog is used. I dont understand why.

here it works https://codepen.io/jacasch/pen/oKWjvx
here it doesn't https://github.com/jacasch/zdog-zoom-test

I could find out why the codepen one works, but not the other one.
it works when you use a <canvas/> but not with <svg/>

demo https://codepen.io/jacasch/pen/KOmVPw

Just in case somebody has still has this problem, this is how I dealt with it:
On redraw explicitly call illustation.setSizeSvg(illustration.width, illustration.height) after updateRenderGraph(), this resets the viewport taking zoom into account.