HID Input: socketIO mouse
This commit is contained in:
parent
fb2c4b4874
commit
12644f1e39
@ -6,6 +6,7 @@
|
||||
<style>
|
||||
</style>
|
||||
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" integrity="sha256-yr4fRk/GU1ehYJPAs8P4JlTgu0Hdsp4ZKrx8bDEDC3I=" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
HID mouse service, POST data to /mouse <br/>
|
||||
@ -24,6 +25,8 @@ var btn=0;
|
||||
var posX=0;
|
||||
var posY=0;
|
||||
|
||||
var socket = io();
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("canvas").mousedown(function(event){
|
||||
@ -57,14 +60,7 @@ function sendMouse(btn, x, y) {
|
||||
wheel: 0,
|
||||
}
|
||||
|
||||
var ret = $.ajax({
|
||||
type: "POST",
|
||||
url: "hid/mouseabs",
|
||||
data: JSON.stringify(obj),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json"
|
||||
});
|
||||
|
||||
socket.emit('mouseEvent', JSON.stringify(obj));
|
||||
};
|
||||
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user