diff --git a/packages/alphatab/src/platform/javascript/BrowserMouseEventArgs.ts b/packages/alphatab/src/platform/javascript/BrowserMouseEventArgs.ts index 5e72ada6b..f92c68b22 100644 --- a/packages/alphatab/src/platform/javascript/BrowserMouseEventArgs.ts +++ b/packages/alphatab/src/platform/javascript/BrowserMouseEventArgs.ts @@ -7,7 +7,7 @@ import type { HtmlElementContainer } from '@coderline/alphatab/platform/javascri * @internal */ export class BrowserMouseEventArgs implements IMouseEventArgs { - public readonly mouseEvent: MouseEvent; + public readonly mouseEvent: PointerEvent; public get isLeftMouseButton(): boolean { return this.mouseEvent.button === 0; @@ -31,7 +31,7 @@ export class BrowserMouseEventArgs implements IMouseEventArgs { this.mouseEvent.preventDefault(); } - public constructor(e: MouseEvent) { + public constructor(e: PointerEvent) { this.mouseEvent = e; } } diff --git a/packages/alphatab/src/platform/javascript/HtmlElementContainer.ts b/packages/alphatab/src/platform/javascript/HtmlElementContainer.ts index a440ec5eb..9b96ab1c1 100644 --- a/packages/alphatab/src/platform/javascript/HtmlElementContainer.ts +++ b/packages/alphatab/src/platform/javascript/HtmlElementContainer.ts @@ -83,12 +83,12 @@ export class HtmlElementContainer implements IHtmlElementContainer { this.mouseDown = { on: (value: any) => { - const nativeListener: (e: MouseEvent) => void = e => { + const nativeListener: (e: PointerEvent) => void = e => { value(new BrowserMouseEventArgs(e)); }; - this.element.addEventListener('mousedown', nativeListener, true); + this.element.addEventListener('pointerdown', nativeListener, true); return () => { - this.element.removeEventListener('mousedown', nativeListener, true); + this.element.removeEventListener('pointerdown', nativeListener, true); }; }, off: (_value: any) => { @@ -98,14 +98,14 @@ export class HtmlElementContainer implements IHtmlElementContainer { this.mouseUp = { on: (value: any) => { - const nativeListener: (e: MouseEvent) => void = e => { + const nativeListener: (e: PointerEvent) => void = e => { value(new BrowserMouseEventArgs(e)); }; - this.element.addEventListener('mouseup', nativeListener, true); + this.element.addEventListener('pointerup', nativeListener, true); return () => { - this.element.removeEventListener('mouseup', nativeListener, true); + this.element.removeEventListener('pointerup', nativeListener, true); }; }, off: (_value: any) => { @@ -115,13 +115,13 @@ export class HtmlElementContainer implements IHtmlElementContainer { this.mouseMove = { on: (value: any) => { - const nativeListener: (e: MouseEvent) => void = e => { + const nativeListener: (e: PointerEvent) => void = e => { value(new BrowserMouseEventArgs(e)); }; - this.element.addEventListener('mousemove', nativeListener, true); + this.element.addEventListener('pointermove', nativeListener, true); return () => { - this.element.removeEventListener('mousemove', nativeListener, true); + this.element.removeEventListener('pointermove', nativeListener, true); }; }, off: (_: any) => {