D
D
Doctor Bi2019-03-14 20:08:39
JavaScript
Doctor Bi, 2019-03-14 20:08:39

Add threshold in fabric.js for pinch gesture?

Good afternoon, I use the fabric-with-gestures
library Out of the box there is support for multi-touch pinch gestures for zooming in and out, as well as for rotation
. But I noticed that the pinch gesture works even when I just touch with two fingers (zoom in and zoom out). In my understanding, it should only work when I started moving my fingers towards each other (zoom in) or away from each other (zoom out).
If anyone has experienced this please help!
PS Code for adding a photo

fabric.Image.fromURL(URL.createObjectURL(image), img => {
      const PADDING = 550;
      img.minScaleLimit = 0.1;
      img.padding = PADDING;
      img.lockScalingFlip = true;
      img.centeredScaling = true;
      img.lockRotation = true;

      if (img.width > img.height) {
        img.scaleToHeight(canvas.getHeight() + PADDING);
      } else {
        img.scaleToWidth(canvas.getWidth() + PADDING);
      }
      canvas.add(img).centerObject(img);
    });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question