From ff9e9946648dec6b8a21367895870a6ca1d64d94 Mon Sep 17 00:00:00 2001 From: futpib Date: Tue, 22 Dec 2020 05:04:35 +0300 Subject: [PATCH] Fix volume slider on high dpi --- components/volume-slider/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/volume-slider/index.js b/components/volume-slider/index.js index 42b9074..8d30720 100644 --- a/components/volume-slider/index.js +++ b/components/volume-slider/index.js @@ -6,8 +6,6 @@ const r = require('r-dom'); const d3 = require('d3'); -const { devicePixelRatio } = window; - const width = 300; const height = 18; @@ -57,15 +55,15 @@ module.exports = class VolumeSlider extends React.Component { handleDragStart() { this._startX = d3.event.x; - this._offsetX = d3.event.sourceEvent.offsetX || (this._lastRenderedX / devicePixelRatio); + this._offsetX = d3.event.sourceEvent.offsetX || (this._lastRenderedX); this.setState({ - draggingX: clamp(this._offsetX * devicePixelRatio), + draggingX: clamp(this._offsetX), }); } handleDrag() { if (this.state.draggingX !== null) { - const draggingX = ((d3.event.x - this._startX) + this._offsetX) * devicePixelRatio; + const draggingX = ((d3.event.x - this._startX) + this._offsetX); this.setState({ draggingX: clamp(draggingX), });