Heiska
Heiska

Reputation: 43

Is there a way to get the zoom level in SVG?

Is there a function that returns the level of the zoom? Or how could you get the level of the zoom with onZoom?

I would like to add/hide some certain elements on SVG when the level of the zoom gets to a certain level. When zoomed enough, an element would be replaced with another element.

Upvotes: 1

Views: 1677

Answers (1)

bumbu
bumbu

Reputation: 1317

getZoom() gives you relative zoom (relative to initial zoom) while getSizes() return real zoom.

Here are all public API methods https://github.com/ariutta/svg-pan-zoom#public-api

Upvotes: 1

Related Questions