2020-07-07 19:36:26 -06:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2020-07-07 19:36:26 -06:00
|
|
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
2024-09-09 14:57:16 +01:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
|
Please see LICENSE files in the repository root for full details.
|
2020-07-07 19:36:26 -06:00
|
|
|
*/
|
|
|
|
|
|
2020-07-08 07:51:04 -06:00
|
|
|
// This is intended to fix re-resizer because of its unguarded `instanceof TouchEvent` checks.
|
2023-01-12 13:25:14 +00:00
|
|
|
export function polyfillTouchEvent(): void {
|
2020-07-08 07:51:04 -06:00
|
|
|
// Firefox doesn't have touch events without touch devices being present, so create a fake
|
|
|
|
|
// one we can rely on lying about.
|
2020-07-07 19:36:26 -06:00
|
|
|
if (!window.TouchEvent) {
|
|
|
|
|
// We have no intention of actually using this, so just lie.
|
|
|
|
|
window.TouchEvent = class TouchEvent extends UIEvent {
|
|
|
|
|
public get altKey(): boolean {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public get changedTouches(): any {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
public get ctrlKey(): boolean {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public get metaKey(): boolean {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public get shiftKey(): boolean {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public get targetTouches(): any {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
public get touches(): any {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
public get rotation(): number {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
public get scale(): number {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
2022-12-16 12:29:59 +00:00
|
|
|
public constructor(eventType: string, params?: any) {
|
2020-07-07 19:36:26 -06:00
|
|
|
super(eventType, params);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|