scroller: use only hv on mobile

old-stable24
Varun Patil 2022-10-20 16:03:33 -07:00
parent c4bcead67f
commit 13388c8afc
1 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="scroller" <div class="scroller" ref="scroller"
v-bind:class="{ v-bind:class="{
'scrolling-recycler': scrollingRecycler, 'scrolling-recycler': scrollingRecycler,
'scrolling': scrolling, 'scrolling': scrolling,
@ -14,7 +14,8 @@
</span> </span>
<span class="cursor hv" <span class="cursor hv"
:style="{ transform: `translateY(${hoverCursorY}px)` }"> :style="{ transform: `translateY(${hoverCursorY}px)` }"
@touchmove="touchmove">
<div class="text"> {{ hoverCursorText }} </div> <div class="text"> {{ hoverCursorText }} </div>
<div class="icon"> <ScrollIcon :size="22" /> </div> <div class="icon"> <ScrollIcon :size="22" /> </div>
</span> </span>
@ -347,7 +348,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
/** Handle touch */ /** Handle touch */
private touchmove(event: any) { private touchmove(event: any) {
const rect = event.target.getBoundingClientRect(); const rect = (this.$refs.scroller as HTMLElement).getBoundingClientRect();
const y = event.targetTouches[0].pageY - rect.top; const y = event.targetTouches[0].pageY - rect.top;
this.recycler.scrollToPosition(this.getRecyclerY(y)); this.recycler.scrollToPosition(this.getRecyclerY(y));
event.preventDefault(); event.preventDefault();
@ -396,6 +397,10 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
// Hide ticks on mobile unless hovering // Hide ticks on mobile unless hovering
@include phone { @include phone {
// Shift pointer events to hover cursor
pointer-events: none;
.cursor.hv { pointer-events: all; }
&:not(.scrolling) { &:not(.scrolling) {
.cursor.hv { .cursor.hv {
left: 5px; left: 5px;