Zooming SVG with Hammer.js

前端 未结 3 1893
有刺的猬
有刺的猬 2021-02-06 15:22

I am writing a cross platform web application that displays information using SVG. I need to have a multi-touch interface to pan and zoom the SVG graphic. From my research, it a

3条回答
  •  难免孤独
    2021-02-06 15:32

    The best method is to use svg transforms, with a combination of translate and scale you can perform a zoom centered on your pinch. You just need to figure out the formula. This example can help you (it uses css transforms but you get the idea): https://github.com/EightMedia/hammer.js/blob/1.0.x/examples/pinchzoom.html

提交回复
热议问题