Is your feature request related to a problem? Please describe.
As it stands getting the x/y location of a tap event requires diving into native code. But touch events are already supplying this utility. This should be extended to tap events.
Describe the solution you'd like
The touch gesture event data methods of getX, and getY should be included in tap event data.
Also a TapGestureEventData interface should be available for type assignment.
export function tapped(args: TapGestureEventData): void {
const tapped_x = args.getX(); // The X axis tap location in DIP
const tapped_y = args.getY(); // The Y axis tap location in DIP
}
Describe alternatives you've considered
Currently you have to dive into platform specific native code to get the tap location. But they are also not in DIP, so that conversion must be done.
import { screen } from "tns-core-modules/platform";
export function tapped(args: GestureEventData): void {
if (args.ios) {
const location = args.ios.locationInView(args.object.ios); //CGPoint in DP.
const x = location.x / screen.mainScreen.scale; // The X axis tap location in DIP
const y = location.y / screen.mainScreen.scale; // The Y axis tap location in DIP
} else {
const x = args.android.getX() / screen.mainScreen.scale; // The X axis tap location in DIP
const y = args.android.getY() / screen.mainScreen.scale; // The Y axis tap location in DIP
}
}
Additional context
Could also extend the getPointerCount, and getAllPointers methods available to touch events. This would give a simple way to handle single or multiple pointer events when you don't require the longer lived event cycle of touch events.
Is your feature request related to a problem? Please describe.
As it stands getting the x/y location of a tap event requires diving into native code. But touch events are already supplying this utility. This should be extended to tap events.
Describe the solution you'd like
The
touchgesture event data methods ofgetX, andgetYshould be included in tap event data.Also a TapGestureEventData interface should be available for type assignment.
Describe alternatives you've considered
Currently you have to dive into platform specific native code to get the tap location. But they are also not in DIP, so that conversion must be done.
Additional context
Could also extend the
getPointerCount, andgetAllPointersmethods available totouchevents. This would give a simple way to handle single or multiple pointer events when you don't require the longer lived event cycle oftouchevents.