I'm new to working with Ionic and would like to get the current coordinates of the touch(or mouse) while pressed(update every 100ms or smth). So the coordinates where the mouse is while pressed. I've tried it with the Ionic Pan gesture but couldn't get it to work.
Any help appreciated!
You can use a simple ion-content element and capture the click event in your comp
<ion-content (click)="getCoordinates($event)">
This is my main content
</ion-content>
Then in your component code just use event.clientX like this:
getCoordinates(ev) {
console.log('x: ' + ev.clientX + ' y: ' + ev.clientY);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With