A workaround for touch dragging
This commit is contained in:
parent
0238110f57
commit
44ba44fc99
|
@ -57,7 +57,7 @@ module.exports = class VolumeSlider extends React.Component {
|
||||||
|
|
||||||
handleDragStart() {
|
handleDragStart() {
|
||||||
this._startX = d3.event.x;
|
this._startX = d3.event.x;
|
||||||
this._offsetX = d3.event.sourceEvent.offsetX;
|
this._offsetX = d3.event.sourceEvent.offsetX || (this._lastRenderedX / devicePixelRatio);
|
||||||
this.setState({
|
this.setState({
|
||||||
draggingX: clamp(this._offsetX * devicePixelRatio),
|
draggingX: clamp(this._offsetX * devicePixelRatio),
|
||||||
});
|
});
|
||||||
|
@ -108,6 +108,8 @@ module.exports = class VolumeSlider extends React.Component {
|
||||||
((height / 2) + vol2pix(value, maxVolume)) :
|
((height / 2) + vol2pix(value, maxVolume)) :
|
||||||
draggingX;
|
draggingX;
|
||||||
|
|
||||||
|
this._lastRenderedX = x;
|
||||||
|
|
||||||
const baseX = (height / 2) + vol2pix(baseVolume, maxVolume);
|
const baseX = (height / 2) + vol2pix(baseVolume, maxVolume);
|
||||||
const normX = (height / 2) + vol2pix(normVolume, maxVolume);
|
const normX = (height / 2) + vol2pix(normVolume, maxVolume);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user