You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
842 B
18 lines
842 B
|
3 years ago
|
import { ToolInstances } from "../types";
|
||
|
|
import { Emit } from "./";
|
||
|
|
|
||
|
|
export function useEvent({ emit, instances }: { emit: Emit; instances: ToolInstances }): void {
|
||
|
|
instances.markTool?.addEventListener("mouseup", e => emit("mark-mouseup", e));
|
||
|
|
|
||
|
|
instances.polygonTool?.addEventListener("draw", e => emit("polygon-draw", e));
|
||
|
|
instances.polygonTool?.addEventListener("addpoint", e => emit("polygon-draw", e));
|
||
|
|
|
||
|
|
instances.polylineTool?.addEventListener("draw", e => emit("polyline-draw", e));
|
||
|
|
instances.polylineTool?.addEventListener("addpoint", e => emit("polyline-addpoint", e));
|
||
|
|
|
||
|
|
instances.rectangleTool?.addEventListener("draw", e => emit("rectangle-draw", e));
|
||
|
|
|
||
|
|
instances.circleTool?.addEventListener("draw", e => emit("circle-draw", e));
|
||
|
|
instances.circleTool?.addEventListener("drawend", e => emit("circle-drawend", e));
|
||
|
|
}
|