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

Fix slider update by touch on iPhone/iPad (#807)

This commit is contained in:
Dmitry Lyzo 2020-02-18 08:13:49 +03:00 committed by GitHub
parent cb48def4ae
commit bd596777aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -254,24 +254,40 @@ define(['browser', 'dom', 'layoutManager', 'keyboardnavigation', 'css!./emby-sli
cancelable: false cancelable: false
})); }));
// Reset dragging (from 'input' event) so that real dragging can be detected // Prevent 'pointermove' and 'click' after 'touch*'
var range = this; // FIXME: Still have some 'pointermove' and 'click' that bypass 'touchstart'
setTimeout(function () { e.preventDefault();
range.dragging = false; }, {
}, 0); capture: true
});
dom.addEventListener(this, 'touchmove', function (e) {
if (!this.touched || e.targetTouches.length !== 1) {
return;
}
var fraction = mapClientToFraction(this, e.targetTouches[0].clientX);
this.value = mapFractionToValue(this, fraction);
this.dispatchEvent(new Event('input', {
bubbles: true,
cancelable: false
}));
}, { }, {
passive: true passive: true
}); });
dom.addEventListener(this, 'touchend', function (e) { dom.addEventListener(this, 'touchend', function (e) {
if (!this.dragging) { var range = this;
this.dispatchEvent(new Event('change', {
setTimeout(function () {
range.touched = false;
range.dispatchEvent(new Event('change', {
bubbles: true, bubbles: true,
cancelable: false cancelable: false
})); }));
} }, 0);
this.touched = false;
}, { }, {
passive: true passive: true
}); });