scroller: fix cursor transform clamping
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/672/head
parent
483bf74d29
commit
ab5627d1f4
|
@ -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%))`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue