diff --git a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts index 6d5a0e4b887..e3c6daf3b27 100644 --- a/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts +++ b/packages/dev/core/src/DeviceInput/InputDevices/webDeviceInputSystem.ts @@ -104,7 +104,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { throw `Unable to find device ${DeviceType[deviceType]}`; } - if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense && navigator.getGamepads) { + if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) { this._updateDevice(deviceType, deviceSlot, inputIndex); } @@ -456,7 +456,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { } } - if (!document.pointerLockElement && this._elementToAttachTo.hasPointerCapture) { + if (!document.pointerLockElement) { try { this._elementToAttachTo.setPointerCapture(this._mouseId); } catch (e) { @@ -465,7 +465,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { } } else { // Touch; Since touches are dynamically assigned, only set capture if we have an id - if (evt.pointerId && !document.pointerLockElement && this._elementToAttachTo.hasPointerCapture) { + if (evt.pointerId && !document.pointerLockElement) { try { this._elementToAttachTo.setPointerCapture(evt.pointerId); } catch (e) { @@ -592,13 +592,11 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { const noop = function () {}; try { - const options: object = { - passive: { - get: function () { - passiveSupported = true; - }, + const options = Object.defineProperty({}, "passive", { + get: function () { + passiveSupported = true; }, - }; + }); this._elementToAttachTo.addEventListener("test", noop, options); this._elementToAttachTo.removeEventListener("test", noop, options); @@ -692,7 +690,7 @@ export class WebDeviceInputSystem implements IDeviceInputSystem { this._elementToAttachTo.addEventListener(this._eventPrefix + "up", this._pointerUpEvent); this._elementToAttachTo.addEventListener(this._eventPrefix + "cancel", this._pointerCancelEvent); this._elementToAttachTo.addEventListener("blur", this._pointerBlurEvent); - this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false); + this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: true } : false); // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {