easier than expected

This commit is contained in:
101arrowz 2019-10-24 22:40:32 -07:00
parent 04e41ac2d1
commit 0a188c4deb

View file

@ -3,18 +3,9 @@ function somethingSelected() {
} }
const remover = / |\n|\t/g; const remover = / |\n|\t/g;
$('.dragscroll').each(function(_, el) { $('.dragscroll').each(function(_, el) {
// Can't directly .mousemove() because need reference to el let previouslyMouseDown = false;
let mouseDown = false;
let previouslyMouseDown = mouseDown;
el.addEventListener('mousedown', function() {
mouseDown = true;
});
el.addEventListener('mouseup', function(e) {
mouseDown = false;
})
el.addEventListener('mouseleave', function() {mouseDown=false});
el.addEventListener('mousemove', function(e) { el.addEventListener('mousemove', function(e) {
if (!mouseDown) { if (e.buttons != 1) {
if (previouslyMouseDown) { if (previouslyMouseDown) {
el.style.removeProperty('user-select'); el.style.removeProperty('user-select');
el.style.removeProperty('-webkit-user-select'); el.style.removeProperty('-webkit-user-select');