2020-05-25 01:55:31 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2020-05-25 02:35:10 +02:00
|
|
|
<title>Mouse remote</title>
|
2020-05-25 01:55:31 +02:00
|
|
|
<style>
|
|
|
|
</style>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
|
2020-06-05 16:37:44 +02:00
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" integrity="sha256-yr4fRk/GU1ehYJPAs8P4JlTgu0Hdsp4ZKrx8bDEDC3I=" crossorigin="anonymous"></script>
|
2020-05-25 01:55:31 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
HID mouse service, POST data to /mouse <br/>
|
|
|
|
<div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
|
2020-06-05 15:04:27 +02:00
|
|
|
var btn=0;
|
|
|
|
var posX=0;
|
|
|
|
var posY=0;
|
2020-06-05 17:05:48 +02:00
|
|
|
var wheel=0;
|
2020-06-05 15:04:27 +02:00
|
|
|
|
2020-06-05 16:37:44 +02:00
|
|
|
var socket = io();
|
|
|
|
|
2020-06-05 15:04:27 +02:00
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
$("canvas").mousedown(function(event){
|
|
|
|
btn=event.buttons;
|
|
|
|
handleMouse();
|
|
|
|
});
|
|
|
|
$("canvas").mouseup(function(event){
|
|
|
|
btn=event.buttons;
|
|
|
|
handleMouse();
|
|
|
|
});
|
2020-06-05 17:05:48 +02:00
|
|
|
$("canvas").mousemove(function(event){
|
|
|
|
posX=event.offsetX;
|
|
|
|
posY=event.offsetY;
|
|
|
|
handleMouse();
|
|
|
|
});
|
2020-06-05 15:04:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function handleMouse() {
|
|
|
|
$("span").text(btn +", "+ posX + ", " + posY);
|
2020-06-05 17:05:48 +02:00
|
|
|
sendMouse(btn, posX, posY, wheel);
|
2020-06-05 15:04:27 +02:00
|
|
|
}
|
|
|
|
|
2020-05-25 02:35:10 +02:00
|
|
|
function sendMouse(btn, x, y) {
|
2020-05-25 01:55:31 +02:00
|
|
|
var obj = {
|
2020-05-25 02:35:10 +02:00
|
|
|
x: x,
|
|
|
|
y: y,
|
|
|
|
btn: btn,
|
2020-06-05 17:05:48 +02:00
|
|
|
wheel: wheel,
|
2020-05-25 01:55:31 +02:00
|
|
|
}
|
|
|
|
|
2020-06-05 16:37:44 +02:00
|
|
|
socket.emit('mouseEvent', JSON.stringify(obj));
|
2020-05-25 01:55:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
</script>
|
2020-06-05 15:04:27 +02:00
|
|
|
<span></span><br/><br/>
|
2020-06-05 17:05:48 +02:00
|
|
|
<canvas width=1920 height=1080 style="border: 1px solid black" oncontextmenu="return false" onwheel='wheel=event.deltaY*-1; handleMouse(); wheel=0; return false;' ></canvas>
|
2020-06-05 15:04:27 +02:00
|
|
|
<!--<img src="placeholder.png" width=1920 height=1080 onmousemove='console.log("aaa");' />-->
|
2020-05-25 01:55:31 +02:00
|
|
|
</body>
|
2020-05-25 02:35:10 +02:00
|
|
|
</html>
|