Skip to content

Commit

Permalink
fix(useMouse): handle Touch class compatibility for Firefox (#3679)
Browse files Browse the repository at this point in the history
  • Loading branch information
elschilling committed Dec 27, 2023
1 parent 669002a commit 5719bfb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/core/useMouse/demo.vue
Expand Up @@ -9,10 +9,12 @@ const parentEl = useParentElement()
const mouseDefault = reactive(useMouse())
const textDefault = stringify(mouseDefault)
const extractor: UseMouseEventExtractor = event => (event instanceof Touch
? null
: [event.offsetX, event.offsetY]
)
const extractor: UseMouseEventExtractor = (event) => {
if (typeof Touch !== 'undefined' && event instanceof Touch)
return null
else
return [event.offsetX, event.offsetY]
}
const mouseWithExtractor = reactive(useMouse({ target: parentEl, type: extractor }))
const textWithExtractor = stringify(mouseWithExtractor)
Expand Down

0 comments on commit 5719bfb

Please sign in to comment.