feat(controller): enhance click action with elementFromPoint

This commit is contained in:
Simon
2026-03-31 20:02:39 +08:00
parent 8eee3b27e2
commit 296459924a
3 changed files with 45 additions and 16 deletions
+13 -1
View File
@@ -48,7 +48,7 @@ export async function waitFor(seconds: number): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, seconds * 1000))
}
// ======= dom utils =======
// ======= mask events =======
export async function movePointerToElement(element: HTMLElement) {
const rect = element.getBoundingClientRect()
@@ -60,3 +60,15 @@ export async function movePointerToElement(element: HTMLElement) {
await waitFor(0.3)
}
export async function clickPointer() {
window.dispatchEvent(new CustomEvent('PageAgent::ClickPointer'))
}
export async function enablePassThrough() {
window.dispatchEvent(new CustomEvent('PageAgent::EnablePassThrough'))
}
export async function disablePassThrough() {
window.dispatchEvent(new CustomEvent('PageAgent::DisablePassThrough'))
}