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

DeviceInputSystem: Add check for matchMedia in WebDeviceInputSystem #12586

Merged
merged 2 commits into from
May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 (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);
Expand Down