From 9b851aac612020345b749941a750b5c0816b295b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Wed, 19 Apr 2023 12:28:14 +0200 Subject: [PATCH] use window matchMedia. --- src/component/cursors.vue | 2 +- src/component/main.vue | 4 ++-- src/component/overlay.vue | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/component/cursors.vue b/src/component/cursors.vue index 396e35b4..7105f193 100644 --- a/src/component/cursors.vue +++ b/src/component/cursors.vue @@ -89,7 +89,7 @@ this.unsubscribePixelRatioChange() } - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`) + const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`) media.addEventListener('change', this.onPixelRatioChange) this.unsubscribePixelRatioChange = () => { media.removeEventListener('change', this.onPixelRatioChange) diff --git a/src/component/main.vue b/src/component/main.vue index 603e40ab..907de97f 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -249,9 +249,9 @@ // check if the device has a touch screen ('ontouchstart' in window || navigator.maxTouchPoints > 0) && // we also check if the device has a pointer - !matchMedia('(pointer:fine)').matches && + !window.matchMedia('(pointer:fine)').matches && // and is capable of hover, then it probably has a mouse - !matchMedia('(hover:hover)').matches + !window.matchMedia('(hover:hover)').matches ) } diff --git a/src/component/overlay.vue b/src/component/overlay.vue index 7d259e41..74a3d29c 100644 --- a/src/component/overlay.vue +++ b/src/component/overlay.vue @@ -513,7 +513,7 @@ this.unsubscribePixelRatioChange() } - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`) + const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`) media.addEventListener('change', this.onPixelRatioChange) this.unsubscribePixelRatioChange = () => { media.removeEventListener('change', this.onPixelRatioChange)