How to get coordinates/location where user clicked on the screen?


Heres what I’m trying to do

If user clicks anywhere on the screen get where they clicked

if click was less then or equal to ~1.5 inches from left side of the screen do x
else do y

Basically like snapchat. If you click a few inches from the left it’ll go back a snap, but if you click anywhere else it’ll go to the next snap

How can I get the screen coordinates?


You can simpely get screen coordinates by an click.
This is an example:

home.html (as example)

<ion-content (click)="getCoordinates($event)">
     This is my main content

home.ts (as example)

    // This output's the X coord of the click

    // This output's the Y coord of the click

I hope I helped you further with your project.