Skip to content

Commit

Permalink
Merge pull request #18 from zqianem/fix-touch
Browse files Browse the repository at this point in the history
Fix interaction on touch devices
  • Loading branch information
simeydotme authored Jan 7, 2021
2 parents 6fe29b2 + 7dc7be8 commit 919506b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/RangeSlider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@
let hPercent = 0;
let hVal = 0;
if (vertical) {
hPos = clientPos.y - dims.top;
hPos = clientPos.clientY - dims.top;
hPercent = (hPos / dims.height) * 100;
hVal = ((max - min) / 100) * hPercent + min;
} else {
hPos = clientPos.x - dims.left;
hPos = clientPos.clientX - dims.left;
hPercent = (hPos / dims.width) * 100;
hVal = ((max - min) / 100) * hPercent + min;
}
Expand Down Expand Up @@ -245,11 +245,11 @@
let hPercent = 0;
let hVal = 0;
if (vertical) {
hPos = clientPos.y - dims.top;
hPos = clientPos.clientY - dims.top;
hPercent = (hPos / dims.height) * 100;
hVal = ((max - min) / 100) * hPercent + min;
} else {
hPos = clientPos.x - dims.left;
hPos = clientPos.clientX - dims.left;
hPercent = (hPos / dims.width) * 100;
hVal = ((max - min) / 100) * hPercent + min;
}
Expand Down

0 comments on commit 919506b

Please sign in to comment.