From 0f6049374f17fd99b4451202232a7e8deb022282 Mon Sep 17 00:00:00 2001 From: brad stein Date: Wed, 24 Oct 2018 21:53:25 -0500 Subject: [PATCH] improved touch draw --- .../__pycache__/settings.cpython-36.pyc | Bin 2662 -> 2668 bytes drawshare/templates/drawshare/room.html | 10 ++++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChannelsDrawShareSite/__pycache__/settings.cpython-36.pyc b/ChannelsDrawShareSite/__pycache__/settings.cpython-36.pyc index 847175adbdbb89a9b00ad764c9d18d1536b0b7f6..d37b3b7345f294cc5d641da42eace371adcbe65a 100644 GIT binary patch delta 290 zcmaDR@D{ zQBP&e63P-z(P(B&(FBW%07bQcqD)!5scb3Q%}gmeU~$nD-4s2bUfmRZFlhiL4Ko?j zS)#;JjH1L-jH4t{B%&mNSPF=xQ%s^{Qka4nG|dvN7#SG2T(S~3yE2Bb3jE?UG&0vS z07Ao;uO%25ChuWW=Z@kGa&_?xjt>p;nf#c|i;-uu9=kdtH&YSF14W!bVsZ$_9=Rw! zXAeg|KUbf4AIC`7px|5Vsd;6YMfrKRnA1~BChKt)v8jVJs83$TxsZ*SiIIs(V6rcl FJOIryM`!>5 diff --git a/drawshare/templates/drawshare/room.html b/drawshare/templates/drawshare/room.html index a12cdbe..8235e1e 100644 --- a/drawshare/templates/drawshare/room.html +++ b/drawshare/templates/drawshare/room.html @@ -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');