diff --git a/packages/axes/src/inputType/InputType.ts b/packages/axes/src/inputType/InputType.ts index 2c79a32d..39695ed1 100644 --- a/packages/axes/src/inputType/InputType.ts +++ b/packages/axes/src/inputType/InputType.ts @@ -77,3 +77,9 @@ export const convertInputType = (inputType: string[] = []): ActiveEvent => { } return null; }; + +export function getAddEventOptions(eventName: string) { + // The passive default value of the touch event is true. + // If not a touch event, return false to support ie11 + return eventName.indexOf("touch") > -1 ? { passive: false } : false; +} diff --git a/packages/axes/src/inputType/PanInput.ts b/packages/axes/src/inputType/PanInput.ts index 7d510057..41e52bd4 100644 --- a/packages/axes/src/inputType/PanInput.ts +++ b/packages/axes/src/inputType/PanInput.ts @@ -25,6 +25,7 @@ import { ActiveEvent, ElementType, InputEventType } from "../types"; import { convertInputType, + getAddEventOptions, InputType, InputTypeObserver, toAxis, @@ -373,10 +374,10 @@ export class PanInput implements InputType { protected _attachWindowEvent(activeEvent: ActiveEvent) { activeEvent?.move.forEach((event) => { - window.addEventListener(event, this._onPanmove, { passive: false }); + window.addEventListener(event, this._onPanmove, getAddEventOptions(event)); }); activeEvent?.end.forEach((event) => { - window.addEventListener(event, this._onPanend, { passive: false }); + window.addEventListener(event, this._onPanend, getAddEventOptions(event)); }); }