File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -42,17 +42,11 @@ export function useTouch() {
4242 }
4343
4444 const getX = ( touch : React . Touch ) => {
45- if ( typeof touch . screenX !== 'undefined' ) return touch . screenX
46- if ( typeof touch . pageX !== 'undefined' ) return touch . pageX
47- if ( typeof touch . clientX !== 'undefined' ) return touch . clientX
48- return 0
45+ return touch . screenX ?? touch . pageX ?? touch . clientX ?? 0
4946 }
5047
5148 const getY = ( touch : React . Touch ) => {
52- if ( typeof touch . screenY !== 'undefined' ) return touch . screenY
53- if ( typeof touch . pageY !== 'undefined' ) return touch . pageY
54- if ( typeof touch . clientY !== 'undefined' ) return touch . clientY
55- return 0
49+ return touch . screenY ?? touch . pageY ?? touch . clientY ?? 0
5650 }
5751
5852 const start = ( event : React . TouchEvent < HTMLElement > ) => {
You can’t perform that action at this time.
0 commit comments