Transmit mouse position info

This commit is contained in:
Frank A. Krueger 2017-07-07 22:54:03 -07:00
parent 0c38e8213c
commit c9f11aa285
1 changed files with 19 additions and 0 deletions

View File

@ -5,6 +5,19 @@ const nodes = {};
let socket = null; let socket = null;
const mouseEvents = {
click: true,
dblclick: true,
mousedown: true,
mouseenter: true,
mouseleave: true,
mousemove: true,
mouseout: true,
mouseover: true,
mouseup: true,
wheel: true,
};
function ooui (rootElementPath) { function ooui (rootElementPath) {
var opened = false; var opened = false;
@ -115,6 +128,12 @@ function msgListen (m) {
node.checked : node.checked :
node.value; node.value;
} }
else if (mouseEvents[m.k]) {
em.v = {
offsetX: e.offsetX,
offsetY: e.offsetY,
};
}
const ems = JSON.stringify (em); const ems = JSON.stringify (em);
socket.send (ems); socket.send (ems);
if (debug) console.log ("Event", em); if (debug) console.log ("Event", em);