NativeScript - Get X and Y on tap event -


i'm doing nativescript-angular-app , have problem.

the user has click on right position on picture.

i don't understand how coordinates of simple tap.

i can coordinate touch gesture (touchgestureeventdata) provides stream of informations. want 1 data.

  • gestureeventdata hasn't getx() method.
  • touchgestureeventdata has getx() method want first touch.

i have tried touch:

public ontouch(args: touchgestureeventdata) {      console.log(args.getactivepointers()[0].getx()); } 

but many data (every movement).

is there way coordinate simple tap?

thanks!

if want single touch event. can check if event action down action or alternatively up action. example below code x , y coordinates of touch-down event , happen once each touch event.

public ontouch(e: touchgestureeventdata) {     if (e && e.action === 'down') {         this.xcoord = e.getx();         this.ycoord = e.gety();     } } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -