amitsingh
amitsingh

Reputation: 240

How do we configure hammerjs pinch in/out speed?

I am using hammerjs pinch in/out on my SVG element. Currently on single pinch out it is zooming out the maximum but I would like to configure the speed so that I can restrict the zoom based on my step (e.g. 1 step-20% zoom).

Upvotes: 1

Views: 586

Answers (1)

rodurico
rodurico

Reputation: 771

You can do something like this in your pinch event, it will cut the pinch speed in half:

this.pinchScale = (event.scale / 2) + 1

And reactively in your container:

width: `${this.containerWidth * this.pinchScale}px`,
height: `${this.containerHeight * this.pinchScale}px`,

Upvotes: 0

Related Questions