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 */
hoverCursorTransform(): string {
const m = utils.isMobile();
const min = m ? '2px' : '0px'; // padding for curvature
const max = `calc(${this.fullHeight - (m ? 6 : 0)}px - 100%)`; // padding for shadow
const val = `calc(${this.hoverCursorY}px - 100%)`;
return `translateY(clamp(${min}, ${val}, ${max}))`;
const mob = utils.isMobile();
const min = this.topPadding + (mob ? 2 : 0); // padding for curvature
const max = this.fullHeight - (mob ? 6 : 0); // padding for shadow
const val = this.hoverCursorY;
const clamp = Math.max(min, Math.min(max, val)); // clamp(min, val, max)
return `translateY(calc(${clamp}px - 100%))`;
},
},