import { testFlag } from '../../../core/flags'; import { SyntheticEvent, Modifier } from './SyntheticEvent'; export { Modifier }; export const enum Button { None = 0x0, Left = 0x1, Right = 0x2, Middle = 0x4 } export class SyntheticMouseEvent extends SyntheticEvent { x: number; y: number; button: Button; buttons: Button; constructor(x = 0, y = 0, button = Button.None, buttons = Button.None, modifiers?: Modifier) { super(modifiers); this.x = x; this.y = y; this.button = button; this.buttons = buttons; } testButton(flag: number) { return testFlag(this.buttons, flag); } static create(x?: number, y?: number, button?: Button, buttons?: Button, modifiers?: Modifier) { return new SyntheticMouseEvent(x, y, button, buttons, modifiers); } static readonly className: string = 'SyntheticMouseEvent'; }