Skip to content

Commit 919506b

Browse files
authored
Merge pull request #18 from zqianem/fix-touch
Fix interaction on touch devices
2 parents 6fe29b2 + 7dc7be8 commit 919506b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/RangeSlider.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@
198198
let hPercent = 0;
199199
let hVal = 0;
200200
if (vertical) {
201-
hPos = clientPos.y - dims.top;
201+
hPos = clientPos.clientY - dims.top;
202202
hPercent = (hPos / dims.height) * 100;
203203
hVal = ((max - min) / 100) * hPercent + min;
204204
} else {
205-
hPos = clientPos.x - dims.left;
205+
hPos = clientPos.clientX - dims.left;
206206
hPercent = (hPos / dims.width) * 100;
207207
hVal = ((max - min) / 100) * hPercent + min;
208208
}
@@ -245,11 +245,11 @@
245245
let hPercent = 0;
246246
let hVal = 0;
247247
if (vertical) {
248-
hPos = clientPos.y - dims.top;
248+
hPos = clientPos.clientY - dims.top;
249249
hPercent = (hPos / dims.height) * 100;
250250
hVal = ((max - min) / 100) * hPercent + min;
251251
} else {
252-
hPos = clientPos.x - dims.left;
252+
hPos = clientPos.clientX - dims.left;
253253
hPercent = (hPos / dims.width) * 100;
254254
hVal = ((max - min) / 100) * hPercent + min;
255255
}

0 commit comments

Comments
 (0)