Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle Touch class compatibility for Firefox #3679

Merged
merged 1 commit into from Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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