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:
parent
cb48def4ae
commit
bd596777aa
1 changed files with 26 additions and 10 deletions
|
@ -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
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue