Pinch to zoom using Hammer.js

后端 未结 4 788
鱼传尺愫
鱼传尺愫 2020-12-02 11:33

I am trying to implement pinch to zoom using hammer.js

Here\'s my HTML-

 

        
4条回答
  •  北海茫月
    2020-12-02 11:49

    Check out the Pinch Zoom and Pan with HammerJS demo. This example has been tested on Android, iOS and Windows Phone.

    You can find the source code at Pinch Zoom and Pan with HammerJS.

    For your convenience, here is the source code:

    
    
    
      
      
      Pinch Zoom
    
    
    
    
      
    Ignore this area. Space is needed to test on the iPhone simulator as pinch simulation on the iPhone simulator requires the target to be near the middle of the screen and we only respect touch events in the image area. This space is not needed in production.

    (BTW, There is a lot of good info above, but I couldn't get any of the examples to actually work and there are some subtle details that I wanted to implement such as consideration of the zoom center).

提交回复
热议问题