Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Pinch and rotate on the same element #380

Open
ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Open

Pinch and rotate on the same element #380

ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Labels

Comments

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 29, 2018

Original issue by @MatteoMeil on 2018-06-25T19:01:09Z

Bug Report

Ionic Info

cli packages: (C:\Users\Matteo\AppData\Roaming\npm\node_modules)
    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:
    cordova (Cordova CLI) : 8.0.0

local packages:
    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:
    Android SDK Tools : 26.1.1
    Node              : v7.10.0
    npm               : 4.2.0
    OS                : Windows 10

Environment Variables:
    ANDROID_HOME : C:\Android

Misc:
    backend : pro

Describe the Bug
When I attach both pinch and rotate gestures to an element they are fired together, even if I touch with two finger the device screen doing nothing.
Also, rotation angle is not so clear: does it take the finger position or the finger rotation?

Steps to Reproduce

  1. Start new project
  2. Create a component and put in it an image (in example)
  3. attach to it pinch and rotate gesture via typescript (attaching gesture as described in the docs doesn't work)

Related Code
HTML:

<ion-header>
    <ion-navbar>
        <ion-title>imageEdit</ion-title>
    </ion-navbar>
</ion-header>
<ion-content padding>
    <img #img src="https://www.w3schools.com/w3css/img_lights.jpg">
</ion-content>

TYPESCRIPT:

@ViewChild('img') imgElem: ElementRef;
img: HTMLImageElement;
gesture: Gesture;

constructor(){}
ionViewDidLoad(){
    this.gesture = new Gesture(this.imgElem.nativeElement);

    this.gesture.listen();
    this.gesture.on('rotate', (e) =>{
        console.log('rotate');
    });
    this.gesture.on('pinch', (e) =>{ 
        console.log('pinch');
    });
}

Expected Behavior

  • Fire nothing if user does nothing on the screen (i.e. only tap with two fingers)
  • Fire one gesture at a time
  • On rotation gesture, take the angle drew by the finger
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

0 participants