mirror of
https://github.com/neogeek23/drawshare.git
synced 2026-02-04 02:58:16 +00:00
improved touch draw
This commit is contained in:
parent
1b00b6827d
commit
0f6049374f
Binary file not shown.
@ -38,8 +38,9 @@
|
||||
window.onresize = function(){resize_canvas()};
|
||||
|
||||
let roomName = {{ room_name_json }};
|
||||
let ws_scheme = window.location.protocol === "https:" ? "wss" : "ws";
|
||||
let drawSocket = new WebSocket(
|
||||
'wss://' + window.location.host +
|
||||
ws_scheme +'://' + window.location.host +
|
||||
'/wss/drawshare/' + roomName + '/');
|
||||
let x1;
|
||||
let y1;
|
||||
@ -69,7 +70,7 @@
|
||||
drawSocket.onclose = function(e) {console.error('Socket closed unexpectedly');};
|
||||
document.querySelector('#draw-canvas').onmousemove = function(e) {cord_start(e); cord_end(); capture_draw()};
|
||||
document.querySelector('#draw-canvas').ontouchstart = function(e) {cord_touch(e, "start")};
|
||||
document.querySelector('#draw-canvas').ontouchmove = function(e) {cord_touch(e, "end"); capture_draw()};
|
||||
document.querySelector('#draw-canvas').ontouchmove = function(e) {cord_touch(e, "end"); capture_draw(); cord_pass_down()};
|
||||
document.querySelector('#draw-clear').onclick = function(){clear_draw()};
|
||||
|
||||
function cord_start(e){
|
||||
@ -109,6 +110,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
function cord_pass_down(){
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
|
||||
function capture_draw(){
|
||||
let drawColor = document.querySelector('#draw-color-select');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user