@openreplay/tracker-assist
Advanced tools
Comparing version 3.5.10 to 3.5.11
@@ -20,3 +20,3 @@ import type { Properties } from 'csstype'; | ||
private readonly noSecureMode; | ||
readonly version = "3.5.10"; | ||
readonly version = "3.5.11"; | ||
private socket; | ||
@@ -23,0 +23,0 @@ private peer; |
@@ -25,3 +25,3 @@ "use strict"; | ||
this.noSecureMode = noSecureMode; | ||
this.version = "3.5.10"; | ||
this.version = "3.5.11"; | ||
this.socket = null; | ||
@@ -120,2 +120,8 @@ this.peer = null; | ||
socket.on("move", remoteControl.move); | ||
socket.on("focus", (clientID, nodeID) => { | ||
const el = app.nodes.getNode(nodeID); | ||
if (el instanceof HTMLElement) { | ||
remoteControl.focus(clientID, el); | ||
} | ||
}); | ||
socket.on("input", remoteControl.input); | ||
@@ -122,0 +128,0 @@ let annot = null; |
@@ -70,14 +70,23 @@ "use strict"; | ||
while (el) { | ||
//if(el.scrollWidth > el.clientWidth) // - This check doesn't work in common case | ||
const esl = el.scrollLeft; | ||
el.scrollLeft += dX; | ||
const est = el.scrollTop; | ||
el.scrollTop += dY; | ||
if (esl !== el.scrollLeft || est !== el.scrollTop) { | ||
this.lastScrEl = el; | ||
return; | ||
// const esl = el.scrollLeft | ||
// el.scrollLeft += dX | ||
// const est = el.scrollTop | ||
// el.scrollTop += dY | ||
// if (esl !== el.scrollLeft || est !== el.scrollTop) { // doesn't work if the scroll-behavior is "smooth" | ||
// this.lastScrEl = el | ||
// return | ||
// } else { | ||
// el = el.parentElement | ||
// } | ||
// el.scrollTopMax > 0 // available in firefox | ||
if (el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth) { | ||
const styles = getComputedStyle(el); | ||
if (styles.overflow.indexOf("scroll") >= 0 || styles.overflow.indexOf("auto") >= 0) { | ||
el.scrollLeft += dX; | ||
el.scrollTop += dY; | ||
this.lastScrEl = el; | ||
return; | ||
} | ||
} | ||
else { | ||
el = el.parentElement; | ||
} | ||
el = el.parentElement; | ||
} | ||
@@ -84,0 +93,0 @@ // If not scrolled |
@@ -19,3 +19,4 @@ import type { Options as AssistOptions } from './Assist'; | ||
click: (id: any, xy: any) => void; | ||
input: (id: any, value: any) => void; | ||
focus: (id: any, el: HTMLElement) => void; | ||
input: (id: any, value: string) => void; | ||
} |
@@ -12,2 +12,7 @@ "use strict"; | ||
})(RCStatus || (RCStatus = {})); | ||
let setInputValue = function (value) { this.value = value; }; | ||
const nativeInputValueDescriptor = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value"); | ||
if (nativeInputValueDescriptor && nativeInputValueDescriptor.set) { | ||
setInputValue = nativeInputValueDescriptor.set; | ||
} | ||
class RemoteControl { | ||
@@ -73,2 +78,5 @@ constructor(options, onGrand, onRelease) { | ||
}; | ||
this.focus = (id, el) => { | ||
this.focused = el; | ||
}; | ||
this.input = (id, value) => { | ||
@@ -80,3 +88,5 @@ if (id !== this.agentID || !this.mouse || !this.focused) { | ||
|| this.focused instanceof HTMLInputElement) { | ||
this.focused.value = value; | ||
setInputValue.call(this.focused, value); | ||
const ev = new Event('input', { bubbles: true }); | ||
this.focused.dispatchEvent(ev); | ||
} | ||
@@ -83,0 +93,0 @@ else if (this.focused.isContentEditable) { |
@@ -20,3 +20,3 @@ import type { Properties } from 'csstype'; | ||
private readonly noSecureMode; | ||
readonly version = "3.5.10"; | ||
readonly version = "3.5.11"; | ||
private socket; | ||
@@ -23,0 +23,0 @@ private peer; |
@@ -23,3 +23,3 @@ import io from 'socket.io-client'; | ||
this.noSecureMode = noSecureMode; | ||
this.version = "3.5.10"; | ||
this.version = "3.5.11"; | ||
this.socket = null; | ||
@@ -118,2 +118,8 @@ this.peer = null; | ||
socket.on("move", remoteControl.move); | ||
socket.on("focus", (clientID, nodeID) => { | ||
const el = app.nodes.getNode(nodeID); | ||
if (el instanceof HTMLElement) { | ||
remoteControl.focus(clientID, el); | ||
} | ||
}); | ||
socket.on("input", remoteControl.input); | ||
@@ -120,0 +126,0 @@ let annot = null; |
@@ -68,14 +68,23 @@ export default class Mouse { | ||
while (el) { | ||
//if(el.scrollWidth > el.clientWidth) // - This check doesn't work in common case | ||
const esl = el.scrollLeft; | ||
el.scrollLeft += dX; | ||
const est = el.scrollTop; | ||
el.scrollTop += dY; | ||
if (esl !== el.scrollLeft || est !== el.scrollTop) { | ||
this.lastScrEl = el; | ||
return; | ||
// const esl = el.scrollLeft | ||
// el.scrollLeft += dX | ||
// const est = el.scrollTop | ||
// el.scrollTop += dY | ||
// if (esl !== el.scrollLeft || est !== el.scrollTop) { // doesn't work if the scroll-behavior is "smooth" | ||
// this.lastScrEl = el | ||
// return | ||
// } else { | ||
// el = el.parentElement | ||
// } | ||
// el.scrollTopMax > 0 // available in firefox | ||
if (el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth) { | ||
const styles = getComputedStyle(el); | ||
if (styles.overflow.indexOf("scroll") >= 0 || styles.overflow.indexOf("auto") >= 0) { | ||
el.scrollLeft += dX; | ||
el.scrollTop += dY; | ||
this.lastScrEl = el; | ||
return; | ||
} | ||
} | ||
else { | ||
el = el.parentElement; | ||
} | ||
el = el.parentElement; | ||
} | ||
@@ -82,0 +91,0 @@ // If not scrolled |
@@ -19,3 +19,4 @@ import type { Options as AssistOptions } from './Assist'; | ||
click: (id: any, xy: any) => void; | ||
input: (id: any, value: any) => void; | ||
focus: (id: any, el: HTMLElement) => void; | ||
input: (id: any, value: string) => void; | ||
} |
@@ -10,2 +10,7 @@ import Mouse from './Mouse.js'; | ||
})(RCStatus || (RCStatus = {})); | ||
let setInputValue = function (value) { this.value = value; }; | ||
const nativeInputValueDescriptor = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value"); | ||
if (nativeInputValueDescriptor && nativeInputValueDescriptor.set) { | ||
setInputValue = nativeInputValueDescriptor.set; | ||
} | ||
export default class RemoteControl { | ||
@@ -71,2 +76,5 @@ constructor(options, onGrand, onRelease) { | ||
}; | ||
this.focus = (id, el) => { | ||
this.focused = el; | ||
}; | ||
this.input = (id, value) => { | ||
@@ -78,3 +86,5 @@ if (id !== this.agentID || !this.mouse || !this.focused) { | ||
|| this.focused instanceof HTMLInputElement) { | ||
this.focused.value = value; | ||
setInputValue.call(this.focused, value); | ||
const ev = new Event('input', { bubbles: true }); | ||
this.focused.dispatchEvent(ev); | ||
} | ||
@@ -81,0 +91,0 @@ else if (this.focused.isContentEditable) { |
{ | ||
"name": "@openreplay/tracker-assist", | ||
"description": "Tracker plugin for screen assistance through the WebRTC", | ||
"version": "3.5.10", | ||
"version": "3.5.11", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "WebRTC", |
113593
2577