refactor: scroller moveto

old-stable24
Varun Patil 2022-10-20 22:24:00 -07:00
parent c85b924a9c
commit fc0b19dbf9
1 changed files with 8 additions and 4 deletions

View File

@ -342,20 +342,24 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
this.moveHoverCursor(this.cursorY);
}
/** Move to given scroller Y */
private moveto(y: number) {
this.recycler.scrollToPosition(this.getRecyclerY(y));
this.handleScroll();
}
/** Handle mouse click */
private mousedown(event: MouseEvent) {
this.recycler.scrollToPosition(this.getRecyclerY(event.offsetY));
this.handleScroll();
this.moveto(event.offsetY);
}
/** Handle touch */
private touchmove(event: any) {
const rect = (this.$refs.scroller as HTMLElement).getBoundingClientRect();
const y = event.targetTouches[0].pageY - rect.top;
this.recycler.scrollToPosition(this.getRecyclerY(y));
event.preventDefault();
event.stopPropagation();
this.handleScroll();
this.moveto(y);
}
/** Update this is being used to scroll recycler */