Fixed mouse wheel in remote desktop

Ylian Saint-Hilaire committed Apr 13, 2018 at 14:09 UTC 149b525826385418bee0919cca389a0e9b72cd4f
3 files changed +19 -32
meshagent.js
+1 -1
@@ -48,7 +48,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
48 // Other clean up may be needed here
49 if (obj.unauth) { delete obj.unauth; }
50 if (obj.agentUpdate != null) { obj.fs.close(obj.agentUpdate.fd); obj.agentUpdate = null; }
51 - if (obj.agentInfo.capabilities & 0x20) { // This is a temporary agent, remote it
51 + if ((obj.agentInfo) && (obj.agentInfo.capabilities) && (obj.agentInfo.capabilities & 0x20)) { // This is a temporary agent, remote it
52 // Delete this node including network interface information and events
53 obj.db.Remove(obj.dbNodeKey); // Remove node with that id
54 obj.db.Remove('if' + obj.dbNodeKey); // Remove interface information
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.1.6-f",
3 + "version": "0.1.6-h",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
views/default.handlebars
+17 -30
@@ -351,18 +351,18 @@
351 </tr>
352 <tr id=deskarea2>
353 <td>
354 - <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div>
354 + <div style=background-color:gray><div id=progressbar style=height:2px;width:0%;background-color:red></div></div>
355 </td>
356 </tr>
357 <tr id=deskarea3>
358 - <td id=deskarea3x style="background:black;text-align:center;height:400px;position:relative">
359 - <div id="DeskFocus" style="color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div>
360 - <div id="DeskParent">
361 - <canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></canvas>
358 + <td id=deskarea3x style=background:black;text-align:center;height:400px;position:relative>
359 + <div id=DeskFocus style="color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></div>
360 + <div id=DeskParent>
361 + <canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel=dmousewheel(event)></canvas>
362 </div>
363 - <div id="DeskTools" style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none">
364 - <a id="DeskToolsRefreshButton" style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a>
365 - <div id="DeskToolsBar" style="position:absolute;padding:3px;border-radius: 3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div>
363 + <div id=DeskTools style="position:absolute;width:400px;height:100%;background-color:gray;top:0;right:0;border-left:2px solid lightgray;display:none">
364 + <a id=DeskToolsRefreshButton style="float:right;padding:3px;cursor:pointer" onclick="refreshDeskTools()">Refresh</a>
365 + <div id=DeskToolsBar style="position:absolute;padding:3px;border-radius: 3px 3px 0px 0px;top:5px;left:4px;bottom:26px;background-color:lightgray;cursor:pointer">Processes</div>
366 <div style="position:absolute;top:26px;left:4px;right:4px;bottom:4px;background-color:lightgray;text-align:left">
367 <div style="border-bottom:1px solid darkgray;padding:3px"><a style=width:50px;padding-right:5px;float:left;cursor:pointer title="Sort by process id" onclick=sortProcess(0)>PID</a><a style=cursor:pointer title="Sort by name" onclick=sortProcess(1)>Name</a></div>
368 <div id="DeskToolsProcesses" style="overflow-y:scroll;position:absolute;top:24px;bottom:0px;width:100%"></div>
@@ -371,10 +371,10 @@
371 </td>
372 </tr>
373 <tr id=deskarea4>
374 - <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
375 - <div style="float:right;text-align:right">
376 - <select id="termdisplays" style="display:none" onchange="deskSetDisplay(event)" onclick="deskGetDisplayNumbers(event)"></select>&nbsp;
377 - <input id="DeskToolsButton" type="button" value="Tools" title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp;
374 + <td style=padding-top:2px;padding-bottom:2px;background:#C0C0C0>
375 + <div style=float:right;text-align:right>
376 + <select id=termdisplays style=display:none onchange=deskSetDisplay(event) onclick=deskGetDisplayNumbers(event)></select>&nbsp;
377 + <input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp;
378 </div>
379 <div>
380 &nbsp;
@@ -777,22 +777,6 @@
777 if (t != null) { multidesktopsettings = JSON.parse(t); }
778 applyDesktopSettings();
779
780 - // Mouse Scroll on desktop
781 - if (navigator.userAgent.match(/mozilla/i)) {
782 - Q('Desk').addEventListener('DOMMouseScroll', function (e) {
783 - return dmousewheel(e);
784 - //if (loginState == 3) { SendMouseMsg(KeyAction.SCROLL, e); return false; }
785 - //return true;
786 - });
787 - }
788 - else {
789 - Q('Desk').addEventListener('mousewheel', function (e) {
790 - return dmousewheel(e);
791 - //if (loginState == 3) { SendMouseMsg(KeyAction.SCROLL, e); return false; }
792 - //return true;
793 - });
794 - }
795 -
780 // Terminal special keys
781 var x = '';
782 for (var c = 1; c < 27; c++) x += "<option value='" + c + "'>Ctrl-" + String.fromCharCode(64 + c) + " (" + c + ")</option>";
@@ -2861,7 +2845,7 @@
2845
2846 function deviceNotesFunction(readonly, nodeid) {
2847 if (xxdialogMode) return;
2864 - setDialogMode(2, "Device Notes", 2, deviceNotesFunctionEx, '<textarea id=d2devNotes ro=' + readonly + ' nodeid=' + nodeid + ' readonly style=width:100%;height:200px;resize:none;overflow-y:scroll></textarea>', nodeid);
2848 + setDialogMode(2, "Device Notes", 2, deviceNotesFunctionEx, '<textarea id=d2devNotes ro=' + readonly + ' nodeid=' + nodeid + ' readonly style=background-color:#fcf3cf;width:100%;height:200px;resize:none;overflow-y:scroll></textarea>', nodeid);
2849 meshserver.send({ action: 'getNotes', nodeid: nodeid });
2850 }
2851
@@ -3192,9 +3176,12 @@
3176 delete multiDesktop[currentNode._id];
3177 } else {
3178 // Device is not already connected, just setup a blank canvas
3195 - QH('DeskParent', '<canvas id="Desk" width="640" height="200" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></canvas>');
3179 + QH('DeskParent', '<canvas id=Desk width=640 height=200 style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event)></canvas>');
3180 desktopNode = currentNode;
3181 }
3182 + // Setup the mouse wheel
3183 + Q('Desk').addEventListener('DOMMouseScroll', function (e) { return dmousewheel(e); });
3184 + Q('Desk').addEventListener('mousewheel', function (e) { return dmousewheel(e); });
3185 }
3186 desktopNode = currentNode;
3187 updateDesktopButtons();