From dcc9f06d3b540223c8fa02231e36eb9cc53012b7 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 6 Dec 2022 12:40:56 -0800 Subject: [PATCH] scroller: add snapping offset --- src/components/ScrollerManager.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ScrollerManager.vue b/src/components/ScrollerManager.vue index b156d3c1..1275c1fd 100644 --- a/src/components/ScrollerManager.vue +++ b/src/components/ScrollerManager.vue @@ -54,6 +54,9 @@ import ScrollIcon from "vue-material-design-icons/UnfoldMoreHorizontal.vue"; import * as utils from "../services/Utils"; +// Pixels to snap at +const SNAP_OFFSET = -35; + @Component({ components: { ScrollIcon, @@ -467,7 +470,7 @@ export default class ScrollerManager extends Mixins(GlobalMixin) { const { top1, top2, y1, y2 } = this.getCoords(y, "topF"); const yfrac = (y - top1) / (top2 - top1); const ry = y1 + (y2 - y1) * (yfrac || 0); - const targetY = snap ? y1 : ry; + const targetY = snap ? y1 + SNAP_OFFSET : ry; if (this.lastRequestedRecyclerY !== targetY) { this.lastRequestedRecyclerY = targetY;