修复拖动喵可能引起的问题

This commit is contained in:
xing 2020-04-04 14:12:59 +08:00
parent 00f6054540
commit ce5a5c032e

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace https://github.com/fthvgb1/tampermonkey-script // @namespace https://github.com/fthvgb1/tampermonkey-script
// @version 0.992 // @version 0.993
// @author fthvgb1 // @author fthvgb1
// @match https://tieba.baidu.com/* // @match https://tieba.baidu.com/*
// @match https://tiebac.baidu.com/* // @match https://tiebac.baidu.com/*
@ -804,7 +804,7 @@
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
let touches = e.touches[0]; let touches = e.touches[0];
let svg = e.target.parentNode.parentNode; let svg = d;
endX = sx - touches.clientX - Math.ceil(svg.offsetWidth / 2); endX = sx - touches.clientX - Math.ceil(svg.offsetWidth / 2);
endY = sy - touches.clientY - Math.ceil(svg.offsetHeight / 2); endY = sy - touches.clientY - Math.ceil(svg.offsetHeight / 2);
if (endX > sx - svg.offsetWidth) { if (endX > sx - svg.offsetWidth) {
@ -832,7 +832,9 @@
timer = setTimeout(() => { timer = setTimeout(() => {
//value.style.touchAction='none'; //value.style.touchAction='none';
value.style.fill = 'rgba(210,74,195,0.3)'; value.style.fill = 'rgba(210,74,195,0.3)';
value.addEventListener('touchmove', drop); value.addEventListener('touchmove', drop, {
passive: false
});
}, 600); }, 600);
}); });
value.addEventListener('touchend', ev => { value.addEventListener('touchend', ev => {