import { MouseButton } from '../../src/App.types'; import type { InputController } from '../../src/inputController/input-controller'; /** * Trigger a click event on the canvas * @param inputController * @param x x-coordinate relative to the left of the draw area excluding the toolbar * @param y y-coordinate relative to the top of the draw area * @param mouseButton */ export function click( inputController: InputController, x: number, y: number, mouseButton: MouseButton = MouseButton.Left ) { inputController.handleMouseUp({ button: mouseButton, // 입력 컨트롤러가 캔버스 bounding rect(시험에서는 0)를 빼므로 화면 좌표를 그대로 준다. clientX: x, clientY: y, preventDefault: () => {}, stopPropagation: () => {}, } as MouseEvent); }