scroller: add snapping offset
parent
6a07f5b02e
commit
dcc9f06d3b
|
@ -54,6 +54,9 @@ import ScrollIcon from "vue-material-design-icons/UnfoldMoreHorizontal.vue";
|
||||||
|
|
||||||
import * as utils from "../services/Utils";
|
import * as utils from "../services/Utils";
|
||||||
|
|
||||||
|
// Pixels to snap at
|
||||||
|
const SNAP_OFFSET = -35;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
ScrollIcon,
|
ScrollIcon,
|
||||||
|
@ -467,7 +470,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) {
|
||||||
const { top1, top2, y1, y2 } = this.getCoords(y, "topF");
|
const { top1, top2, y1, y2 } = this.getCoords(y, "topF");
|
||||||
const yfrac = (y - top1) / (top2 - top1);
|
const yfrac = (y - top1) / (top2 - top1);
|
||||||
const ry = y1 + (y2 - y1) * (yfrac || 0);
|
const ry = y1 + (y2 - y1) * (yfrac || 0);
|
||||||
const targetY = snap ? y1 : ry;
|
const targetY = snap ? y1 + SNAP_OFFSET : ry;
|
||||||
|
|
||||||
if (this.lastRequestedRecyclerY !== targetY) {
|
if (this.lastRequestedRecyclerY !== targetY) {
|
||||||
this.lastRequestedRecyclerY = targetY;
|
this.lastRequestedRecyclerY = targetY;
|
||||||
|
|
Loading…
Reference in New Issue