scroller: add guards
parent
7de0ae7c9d
commit
adafc999c9
|
@ -93,9 +93,14 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
|||
|
||||
/** Recycler scroll event, must be called by timeline */
|
||||
public recyclerScrolled(event?: any) {
|
||||
// Ignore if not initialized
|
||||
if (!this.ticks.length) return;
|
||||
|
||||
// Move hover cursor to px position
|
||||
this.cursorY = utils.roundHalf(event ? event.target.scrollTop * this.height / this.recyclerHeight : 0);
|
||||
this.moveHoverCursor(this.cursorY);
|
||||
|
||||
// Show the scroller for some time
|
||||
if (this.scrollingRecyclerTimer) window.clearTimeout(this.scrollingRecyclerTimer);
|
||||
this.scrollingRecycler = true;
|
||||
this.scrollingRecyclerTimer = window.setTimeout(() => {
|
||||
|
@ -124,6 +129,9 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
|||
|
||||
/** Re-create tick data */
|
||||
private reflowNow() {
|
||||
// Ignore if not initialized
|
||||
if (!this.recycler?.$refs.wrapper) return;
|
||||
|
||||
// Refresh height of recycler
|
||||
this.recyclerHeight = this.recycler.$refs.wrapper.clientHeight;
|
||||
|
||||
|
|
Loading…
Reference in New Issue