|
|
@ -62,29 +62,22 @@ class Scroller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
scrollTo(x, y) { |
|
|
|
scrollTo(x, y) { |
|
|
|
let behavior = this.smooth ? 'smooth' : 'auto'; |
|
|
|
if (!this.smooth) { |
|
|
|
|
|
|
|
this.element.scrollTo(x, y); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
this.element.scrollTo({ |
|
|
|
this.element.scrollTo({ |
|
|
|
left: x, |
|
|
|
left: x, |
|
|
|
top: y, |
|
|
|
top: y, |
|
|
|
behavior: behavior, |
|
|
|
behavior: 'smooth', |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (!this.smooth) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.prepareReset(); |
|
|
|
this.prepareReset(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
scrollBy(x, y) { |
|
|
|
scrollBy(x, y) { |
|
|
|
let behavior = this.smooth ? 'smooth' : 'auto'; |
|
|
|
let left = this.element.scrollLeft + x; |
|
|
|
this.element.scrollBy({ |
|
|
|
let top = this.element.scrollTop + y; |
|
|
|
left: x, |
|
|
|
this.scrollTo(left, top); |
|
|
|
top: y, |
|
|
|
|
|
|
|
behavior: behavior, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (!this.smooth) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.prepareReset(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
prepareReset() { |
|
|
|
prepareReset() { |
|
|
|