tracker: fix remote control clicks on svg
This commit is contained in:
parent
ac0ccb2169
commit
eb610d1c21
6 changed files with 20 additions and 6 deletions
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@openreplay/tracker-assist",
|
||||
"description": "Tracker plugin for screen assistance through the WebRTC",
|
||||
"version": "11.0.2-beta.1",
|
||||
"version": "11.0.2",
|
||||
"keywords": [
|
||||
"WebRTC",
|
||||
"assistance",
|
||||
|
|
|
|||
|
|
@ -63,8 +63,21 @@ export default class Mouse {
|
|||
|
||||
click(pos: XY) {
|
||||
const el = document.elementFromPoint(pos[0], pos[1])
|
||||
if (el instanceof HTMLElement) {
|
||||
el.click()
|
||||
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
||||
try {
|
||||
const clickEvent = new MouseEvent('click', {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
view: window,
|
||||
clientX: pos[0],
|
||||
clientY: pos[1]
|
||||
})
|
||||
el.dispatchEvent(clickEvent)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// @ts-ignore
|
||||
el.click && el.click()
|
||||
}
|
||||
el.focus()
|
||||
return el
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ export default class RemoteControl {
|
|||
move = (id, xy) => {
|
||||
return id === this.agentID && this.mouse?.move(xy)
|
||||
}
|
||||
private focused: HTMLElement | null = null
|
||||
private focused: HTMLElement | SVGElement | null = null
|
||||
click = (id, xy) => {
|
||||
if (id !== this.agentID || !this.mouse) { return }
|
||||
this.focused = this.mouse.click(xy)
|
||||
|
|
@ -132,7 +132,9 @@ export default class RemoteControl {
|
|||
setInputValue.call(this.focused, value)
|
||||
const ev = new Event('input', { bubbles: true,})
|
||||
this.focused.dispatchEvent(ev)
|
||||
// @ts-ignore
|
||||
} else if (this.focused.isContentEditable) {
|
||||
// @ts-ignore
|
||||
this.focused.innerText = value
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export const pkgVersion = "11.0.2-beta.1";
|
||||
export const pkgVersion = "11.0.2";
|
||||
|
|
|
|||
|
|
@ -881,7 +881,6 @@ export default class App {
|
|||
}
|
||||
|
||||
this.emptyBatchCounter = 0
|
||||
console.log('messages', this.messages.join(', '))
|
||||
|
||||
try {
|
||||
requestIdleCb(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue