Title: Tap event data should include touch location · Issue #8407 · NativeScript/NativeScript · GitHub
Open Graph Title: Tap event data should include touch location · Issue #8407 · NativeScript/NativeScript
X Title: Tap event data should include touch location · Issue #8407 · NativeScript/NativeScript
Description: 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 eve...
Open Graph Description: 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 uti...
X Description: 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 uti...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/8407
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tap event data should include touch location","articleBody":"**Is your feature request related to a problem? Please describe.**\r\n\u003c!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]. --\u003e \r\nAs 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.\r\n\r\n**Describe the solution you'd like**\r\n\u003c!-- A clear and concise description of what you want to happen. --\u003e\r\nThe `touch` gesture event data methods of `getX`, and `getY` should be included in tap event data.\r\n\r\nAlso a TapGestureEventData interface should be available for type assignment.\r\n\r\n```ts\r\nexport function tapped(args: TapGestureEventData): void {\r\n const tapped_x = args.getX(); // The X axis tap location in DIP\r\n const tapped_y = args.getY(); // The Y axis tap location in DIP\r\n}\r\n```\r\n\r\n**Describe alternatives you've considered**\r\n\u003c!-- A clear and concise description of any alternative solutions or features you've considered. --\u003e\r\nCurrently 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.\r\n```ts\r\nimport { screen } from \"tns-core-modules/platform\";\r\n\r\nexport function tapped(args: GestureEventData): void {\r\n if (args.ios) {\r\n const location = args.ios.locationInView(args.object.ios); //CGPoint in DP.\r\n const x = location.x / screen.mainScreen.scale; // The X axis tap location in DIP\r\n const y = location.y / screen.mainScreen.scale; // The Y axis tap location in DIP\r\n } else {\r\n const x = args.android.getX() / screen.mainScreen.scale; // The X axis tap location in DIP\r\n const y = args.android.getY() / screen.mainScreen.scale; // The Y axis tap location in DIP\r\n }\r\n}\r\n```\r\n\r\n**Additional context**\r\n\u003c!-- Add any other context or screenshots about the feature request here. --\u003e\r\nCould 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.","author":{"url":"https://github.com/mudlabs","@type":"Person","name":"mudlabs"},"datePublished":"2020-03-03T01:08:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/8407/NativeScript/issues/8407"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9e4515da-410d-8df2-2057-c420b8a0e1bb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C4A6:1AD267:5BB55C3:7C89FDB:69733C64 |
| html-safe-nonce | c963467b1284bf59b91e0b55d6446c48e6304140fded6f99ec667fefe866bada |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEE2OjFBRDI2Nzo1QkI1NUMzOjdDODlGREI6Njk3MzNDNjQiLCJ2aXNpdG9yX2lkIjoiMTM1MTczNjgyMTE1MDY2OTgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f7ff1b9459e4e2f75fba7d6409f6caa8766474dc6c34ef46f543d75e77403bf2 |
| hovercard-subject-tag | issue:574350102 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/8407/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d261d1d16b92a2aff69cfe2116c2167c84b627427ee1089a20a077c57cd35548/NativeScript/NativeScript/issues/8407 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d261d1d16b92a2aff69cfe2116c2167c84b627427ee1089a20a077c57cd35548/NativeScript/NativeScript/issues/8407 |
| og:image:alt | 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 uti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mudlabs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 75e56b01124e79ebbaa7864231f25e58fc1b5f25 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width