From cda00423af779b5cba818ef380107e8536ba4f96 Mon Sep 17 00:00:00 2001 From: Dave Solares <50599569+PolygonalSun@users.noreply.github.com> Date: Wed, 25 May 2022 11:25:36 -0700 Subject: [PATCH 1/2] added check for matchMedia --- .../core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts index 48f8b739424..a0ec648d6bc 100644 --- a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts +++ b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts @@ -231,7 +231,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { } // If the device in use has mouse capabilities, pre-register mouse - if (matchMedia("(pointer:fine)").matches) { + if (globalThis.matchMedia && matchMedia("(pointer:fine)").matches) { // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens. // There isn't any good way to get the current position outside of a pointer event so that's why this was done. this._addPointerDevice(DeviceType.Mouse, 0, 0, 0); From dde3f0009129efa3faf3c6d7ff95b68c7ea8f9c1 Mon Sep 17 00:00:00 2001 From: Dave <50599569+PolygonalSun@users.noreply.github.com> Date: Wed, 25 May 2022 12:49:33 -0700 Subject: [PATCH 2/2] Update packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts Co-authored-by: Gary Hsu --- .../core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts index a0ec648d6bc..6d5a0e4b887 100644 --- a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts +++ b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts @@ -231,7 +231,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { } // If the device in use has mouse capabilities, pre-register mouse - if (globalThis.matchMedia && matchMedia("(pointer:fine)").matches) { + if (typeof matchMedia === "function" && matchMedia("(pointer:fine)").matches) { // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens. // There isn't any good way to get the current position outside of a pointer event so that's why this was done. this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);