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)