Heres what I’m trying to do
If user clicks anywhere on the screen get where they clicked
then
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
</ion-content>
home.ts (as example)
getCoordinates(event)
{
// This output's the X coord of the click
console.log(event.clientX);
// This output's the Y coord of the click
console.log(event.clientY);
}
I hope I helped you further with your project.
3 Likes