web/DonateOptionsCard: add 5px of tolerance for max position

fixes right stepper not hiding itself in chrome when manually scrolled to the end
This commit is contained in:
wukko 2024-09-30 18:16:52 +06:00
parent b4dd506f61
commit 31be60484d
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -84,8 +84,8 @@
const scroll = (direction: "left" | "right") => {
const currentPos = donateList.scrollLeft;
const newPos = direction === "left" ? currentPos - 150 : currentPos + 150;
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width;
const newPos = direction === "left" ? currentPos - 150 : currentPos + 150;
donateList.scroll({
left: newPos,
@ -171,7 +171,7 @@
bind:this={donateList}
on:wheel={() => {
const currentPos = donateList.scrollLeft;
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width;
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width - 5;
showLeftScroll = currentPos > 0;
showRightScroll = currentPos < maxPos && currentPos !== maxPos;
}}