tauri-plugin-polygon-api
Version:
A plugin for [tauri@v2](https://tauri.app/) to achieve click-through of the tauri main window by allowing developers to define polygons, thus customizing the mouse response area.
53 lines (52 loc) • 1.44 kB
TypeScript
interface Response {
ok: boolean;
error?: string;
}
declare function register(id: string): Promise<Response>;
declare function registerAll(ids: [string]): Promise<Response>;
declare function remove(id: string): Promise<Response>;
declare function clear(): Promise<Response>;
declare function show(id: string): Promise<Response>;
declare function hide(id: string): Promise<Response>;
declare function update(id: string, points: [[number, number]]): Promise<Response>;
type Payload = ClickPayload | DragPayload | ErrorPayload | WheelPayload;
interface ClickPayload {
position: {
x: number;
y: number;
};
}
interface WheelPayload {
delta: {
x: number;
y: number;
};
}
interface DragPayload {
from: {
x: number;
y: number;
};
to: {
x: number;
y: number;
};
}
interface ErrorPayload {
error: string;
}
type Event = "LeftClick" | "DoubleClick" | "RightClick" | "Drag" | "MouseMove" | "Wheel" | "Error";
declare function on(evt: Event, callback: (payload: Payload) => void): void;
declare function off(evt: Event, callback: (payload: Payload) => void): void;
export declare const polygon: {
register: typeof register;
registerAll: typeof registerAll;
remove: typeof remove;
clear: typeof clear;
show: typeof show;
hide: typeof hide;
update: typeof update;
on: typeof on;
off: typeof off;
};
export {};