-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rochmar Nicolas (DevExpress)
committed
Jul 23, 2024
1 parent
57c0645
commit d93ebc6
Showing
2 changed files
with
14 additions
and
15 deletions.
There are no files selected for viewing
28 changes: 13 additions & 15 deletions
28
packages/devextreme/js/__internal/events/core/m_hook_touch_props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
const touchPropsToHook = ['pageX', 'pageY', 'screenX', 'screenY', 'clientX', 'clientY']; | ||
const touchPropHook = function(name, event) { | ||
if(event[name] && !event.touches || !event.touches) { | ||
return event[name]; | ||
} | ||
const touchPropHook = function (name, event) { | ||
if (event[name] && !event.touches || !event.touches) { | ||
return event[name]; | ||
} | ||
|
||
const touches = event.touches.length ? event.touches : event.changedTouches; | ||
if(!touches.length) { | ||
return; | ||
} | ||
const touches = event.touches.length ? event.touches : event.changedTouches; | ||
if (!touches.length) { | ||
return; | ||
} | ||
|
||
return touches[0][name]; | ||
return touches[0][name]; | ||
}; | ||
|
||
export default function(callback) { | ||
touchPropsToHook.forEach(function(name) { | ||
callback(name, function(event) { | ||
return touchPropHook(name, event); | ||
}); | ||
}, this); | ||
export default function (callback) { | ||
touchPropsToHook.forEach((name) => { | ||
callback(name, (event) => touchPropHook(name, event)); | ||
}, this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '../../__internal/events/core/m_hook_touch_props'; |