-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_console.html
121 lines (91 loc) · 4.08 KB
/
s_console.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Socket.IO whiteboard</title>
<link rel="stylesheet" href="styles/consoles/t_console.css">
<link rel="stylesheet" href="styles/mq/consoles/t_console.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="/socket.io/socket.io.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.4.0/socket.io.js"></script>
</head>
<body>
<canvas id="myCanvas" width="1000" height="500" onmousemove="myfunction(event)" style="border:1px solid #d63737;
background-color: white;" ></canvas>
<div class="container">
<!-- <div class="whiteboard-container">
<canvas id = class="whiteboard"></canvas>
</div> -->
<!-- <canvas id="myCanvas" width="1000" height="500" onmousemove="myfunction(event)" style="border:1px solid #d63737;
background-color: white;" ></canvas> -->
<div class="panel-container">
<div class="chat-msg-send">
<input id="chat-input" type="text">
<input type="submit" id="send" value="Send Message">
</div>
<div class="chat-box">
<span>
<b style="font-weight: 900;">
------
</b>
</span>
<div id="chat"></div>
</div>
<video id="video" autoplay style="display: none;"></video>
</div>
</div>
<!script src="https://code.jquery.com/jquery-1.10.2.min.js">
</script>
<script src="https://cdn.socket.io/3.1.3/socket.io.min.js" integrity="sha384-cPwlPLvBTa3sKAgddT6krw0cJat7egBga3DJepJyrLl4Q9/5WLra3rrnMcyTyOnh" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface"></script>
<script src="scripts/s_console.js"></script>
<script src="scripts/clearMessage.js"></script>
<script >
// var socket = io.connect('http://localhost:3000/')
// var socket = io('http://local')
// var socket = io()
var x;
var y;
let mousedown = false;
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
// function myfunction(event)
// {
window.onmousedown = (e) => {
ctx.moveTo(x, y);
// socket.emit('down',{x,y});
mousedown = true;
}
window.onmouseup = (e) => {
mousedown = false;
}
// socket.on('ondraw',({x,y}) =>
// {
// ctx.lineTo(x, y);
// // socket.emit('draw',(x,y))
// ctx.stroke();
// });
// socket.on('ondown',({x,y})=>
// {
// ctx.moveTo(x, y);
// });
window.onmousemove = (e) => {
x = event.clientX;
y = event.clientY;
if (mousedown) {
// socket.emit('draw',{x,y});
// io.emit('draw',(x,y))
ctx.lineTo(x, y);
// socket.emit('draw',(x,y))
ctx.stroke();
var st = "X coordinate is " + x + " and y coordinate is " + y;
console.log(st);
}
}
// }
</script>
</body>
</html>