From 638b05a49a5de084fc83e6129e20afe8a76e98e1 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 14 Aug 2021 22:40:54 +0200 Subject: [PATCH] fix image-viewer touch handler --- copyparty/web/baguettebox.js | 7 +++++-- copyparty/web/browser.css | 2 +- copyparty/web/util.js | 11 +++++++++++ docs/notes.sh | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index b756b5bd..d4a59e77 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -49,7 +49,7 @@ window.baguetteBox = (function () { }; var touchstartHandler = function (e) { - touch.count++; + touch.count = e.touches.length; if (touch.count > 1) touch.multitouch = true; @@ -72,8 +72,11 @@ window.baguetteBox = (function () { hideOverlay(); } }; - var touchendHandler = function () { + var touchendHandler = function (e) { touch.count--; + if (e && e.touches) + touch.count = e.touches.length; + if (touch.count <= 0) touch.multitouch = false; diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 6d16906b..3bd4df44 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1294,7 +1294,7 @@ html.light #tree::-webkit-scrollbar { opacity: 0; position: fixed; overflow: hidden; - touch-action: none; + touch-action: pinch-zoom; top: 0; left: 0; width: 100%; diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 242a63f4..85f6595a 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -775,3 +775,14 @@ var modal = (function () { return r; })(); + + +function winpopup(txt) { + fetch(get_evpath(), { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' + }, + body: 'msg=' + uricom_enc(Date.now() + ', ' + txt) + }); +} diff --git a/docs/notes.sh b/docs/notes.sh index 7f5c610e..ca165614 100644 --- a/docs/notes.sh +++ b/docs/notes.sh @@ -173,7 +173,7 @@ about:config >> devtools.debugger.prefs-schema-version = -1 git pull; git reset --hard origin/HEAD && git log --format=format:"%H %ai %d" --decorate=full > ../revs && cat ../{util,browser,up2k}.js >../vr && cat ../revs | while read -r rev extra; do (git reset --hard $rev >/dev/null 2>/dev/null && dsz=$(cat copyparty/web/{util,browser,up2k}.js >../vg 2>/dev/null && diff -wNarU0 ../{vg,vr} | wc -c) && printf '%s %6s %s\n' "$rev" $dsz "$extra")