scroller: fix cursor transform clamping

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/672/head
Varun Patil 2023-05-30 10:50:33 -07:00
parent 483bf74d29
commit ab5627d1f4
1 changed files with 6 additions and 5 deletions

View File

@ -155,11 +155,12 @@ export default defineComponent({
/** Position of hover cursor */ /** Position of hover cursor */
hoverCursorTransform(): string { hoverCursorTransform(): string {
const m = utils.isMobile(); const mob = utils.isMobile();
const min = m ? '2px' : '0px'; // padding for curvature const min = this.topPadding + (mob ? 2 : 0); // padding for curvature
const max = `calc(${this.fullHeight - (m ? 6 : 0)}px - 100%)`; // padding for shadow const max = this.fullHeight - (mob ? 6 : 0); // padding for shadow
const val = `calc(${this.hoverCursorY}px - 100%)`; const val = this.hoverCursorY;
return `translateY(clamp(${min}, ${val}, ${max}))`; const clamp = Math.max(min, Math.min(max, val)); // clamp(min, val, max)
return `translateY(calc(${clamp}px - 100%))`;
}, },
}, },