1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4774 from thornbill/owner-of-a-lonely-if

This commit is contained in:
Bill Thornton 2023-09-14 10:53:21 -04:00 committed by GitHub
commit bb44ba022d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 155 additions and 223 deletions

View file

@ -130,17 +130,15 @@ class NavDrawer {
if (this.isPeeking) {
this.onMenuTouchMove(e);
} else {
if ((getTouches(e)[0]?.clientX || 0) <= options.handleSize) {
this.isPeeking = true;
} else if ((getTouches(e)[0]?.clientX || 0) <= options.handleSize) {
this.isPeeking = true;
if (e.type === 'touchstart') {
dom.removeEventListener(this.edgeContainer, 'touchmove', this.onEdgeTouchMove, {});
dom.addEventListener(this.edgeContainer, 'touchmove', this.onEdgeTouchMove, {});
}
this.onMenuTouchStart(e);
if (e.type === 'touchstart') {
dom.removeEventListener(this.edgeContainer, 'touchmove', this.onEdgeTouchMove, {});
dom.addEventListener(this.edgeContainer, 'touchmove', this.onEdgeTouchMove, {});
}
this.onMenuTouchStart(e);
}
};
@ -247,14 +245,10 @@ class NavDrawer {
} else {
this.close();
}
} else {
if (this.newPos >= 100) {
this.open();
} else {
if (this.newPos) {
this.close();
}
}
} else if (this.newPos >= 100) {
this.open();
} else if (this.newPos) {
this.close();
}
}
@ -321,19 +315,17 @@ class NavDrawer {
passive: true
});
}
} else {
if (this._edgeSwipeEnabled) {
this._edgeSwipeEnabled = false;
dom.removeEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
passive: true
});
dom.removeEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
passive: true
});
dom.removeEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
passive: true
});
}
} else if (this._edgeSwipeEnabled) {
this._edgeSwipeEnabled = false;
dom.removeEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
passive: true
});
dom.removeEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
passive: true
});
dom.removeEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
passive: true
});
}
}
}

View file

@ -258,12 +258,10 @@ const scrollerFactory = function (frame, options) {
} else {
container.scrollTo(0, Math.round(pos));
}
} else if (o.horizontal) {
container.scrollLeft = Math.round(pos);
} else {
if (o.horizontal) {
container.scrollLeft = Math.round(pos);
} else {
container.scrollTop = Math.round(pos);
}
container.scrollTop = Math.round(pos);
}
}
@ -507,14 +505,12 @@ const scrollerFactory = function (frame, options) {
// If the pointer was released, the path will not become longer and it's
// definitely not a drag. If not released yet, decide on next iteration
return dragging.released ? dragEnd() : undefined;
} else {
} else if (o.horizontal ? Math.abs(dragging.pathX) > Math.abs(dragging.pathY) : Math.abs(dragging.pathX) < Math.abs(dragging.pathY)) {
// If dragging path is sufficiently long we can confidently start a drag
// if drag is in different direction than scroll, ignore it
if (o.horizontal ? Math.abs(dragging.pathX) > Math.abs(dragging.pathY) : Math.abs(dragging.pathX) < Math.abs(dragging.pathY)) {
dragging.init = 1;
} else {
return dragEnd();
}
dragging.init = 1;
} else {
return dragEnd();
}
}