mirror of
https://github.com/wassname/template.git
synced 2026-07-13 17:46:00 +08:00
Touch events x position bug
This commit is contained in:
+3
-1
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user