Fix sidebar opening for fast mouse movements

This commit is contained in:
shortcutme 2019-04-04 13:28:38 +02:00
parent 84268cd43c
commit a208f47b6a
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 9 additions and 8 deletions

View file

@ -40,11 +40,15 @@ class Sidebar extends Class
# Disable previous listeners
@fixbutton.off "click touchend touchcancel"
@fixbutton.off "mousemove touchmove"
# Make sure its not a click
@dragStarted = (+ new Date)
@fixbutton.one "mousemove touchmove", (e) =>
# Fullscreen drag bg to capture mouse events over iframe
$(".drag-bg").remove()
$("<div class='drag-bg'></div>").appendTo(document.body)
$("body").one "mousemove touchmove", (e) =>
mousex = e.pageX
mousey = e.pageY
if not mousex
@ -80,9 +84,6 @@ class Sidebar extends Class
@fixbutton.addClass("dragging")
# Fullscreen drag bg to capture mouse events over iframe
$("<div class='drag-bg'></div>").appendTo(document.body)
# IE position wrap fix
if navigator.userAgent.indexOf('MSIE') != -1 or navigator.appVersion.indexOf('Trident/') > 0
@fixbutton.css("pointer-events", "none")

View file

@ -416,9 +416,10 @@ window.initScrollable = function () {
}
e.preventDefault();
_this.fixbutton.off("click touchend touchcancel");
_this.fixbutton.off("mousemove touchmove");
_this.dragStarted = +(new Date);
return _this.fixbutton.one("mousemove touchmove", function(e) {
$(".drag-bg").remove();
$("<div class='drag-bg'></div>").appendTo(document.body);
return $("body").one("mousemove touchmove", function(e) {
var mousex, mousey;
mousex = e.pageX;
mousey = e.pageY;
@ -464,7 +465,6 @@ window.initScrollable = function () {
this.log("startDrag");
this.fixbutton_targetx = this.fixbutton_initx;
this.fixbutton.addClass("dragging");
$("<div class='drag-bg'></div>").appendTo(document.body);
if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
this.fixbutton.css("pointer-events", "none");
}