Touch events x position bug

This commit is contained in:
Shan Carter
2017-10-23 11:20:24 -07:00
parent 0ff1261b81
commit f046442753
+3 -1
View File
@@ -156,6 +156,7 @@ export class Slider extends T(HTMLElement) {
this.dragUpdate();
})
.on("drag", () => {
console.log(event)
this.dragUpdate();
})
.on("end", () => {
@@ -259,8 +260,9 @@ export class Slider extends T(HTMLElement) {
dragUpdate() {
const bbox = this.background.getBoundingClientRect();
console.log(event, bbox, bbox.left)
const left = bbox.left;
const x = event.x - left;
const x = event.pageX - left;
const width = bbox.width;
this.update(this.scale.invert(x / width));
}