MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / pointerCoord

Function pointerCoord

core/src/utils/helpers.ts:301–315  ·  view source on GitHub ↗
(ev: any)

Source from the content-addressed store, hash-verified

299};
300
301export const pointerCoord = (ev: any): { x: number; y: number } => {
302 // get X coordinates for either a mouse click
303 // or a touch depending on the given event
304 if (ev) {
305 const changedTouches = ev.changedTouches;
306 if (changedTouches && changedTouches.length > 0) {
307 const touch = changedTouches[0];
308 return { x: touch.clientX, y: touch.clientY };
309 }
310 if (ev.pageX !== undefined) {
311 return { x: ev.pageX, y: ev.pageY };
312 }
313 }
314 return { x: 0, y: 0 };
315};
316
317/**
318 * @hidden

Callers 1

setActivatedElementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected