A workaround for touch dragging

This commit is contained in:
futpib 2018-11-14 03:01:31 +03:00
parent 0238110f57
commit 44ba44fc99

View File

@ -57,7 +57,7 @@ module.exports = class VolumeSlider extends React.Component {
handleDragStart() {
this._startX = d3.event.x;
this._offsetX = d3.event.sourceEvent.offsetX;
this._offsetX = d3.event.sourceEvent.offsetX || (this._lastRenderedX / devicePixelRatio);
this.setState({
draggingX: clamp(this._offsetX * devicePixelRatio),
});
@ -108,6 +108,8 @@ module.exports = class VolumeSlider extends React.Component {
((height / 2) + vol2pix(value, maxVolume)) :
draggingX;
this._lastRenderedX = x;
const baseX = (height / 2) + vol2pix(baseVolume, maxVolume);
const normX = (height / 2) + vol2pix(normVolume, maxVolume);