mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-29 11:06:10 +00:00
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:
parent
b4dd506f61
commit
31be60484d
|
@ -84,8 +84,8 @@
|
||||||
|
|
||||||
const scroll = (direction: "left" | "right") => {
|
const scroll = (direction: "left" | "right") => {
|
||||||
const currentPos = donateList.scrollLeft;
|
const currentPos = donateList.scrollLeft;
|
||||||
const newPos = direction === "left" ? currentPos - 150 : currentPos + 150;
|
|
||||||
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width;
|
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width;
|
||||||
|
const newPos = direction === "left" ? currentPos - 150 : currentPos + 150;
|
||||||
|
|
||||||
donateList.scroll({
|
donateList.scroll({
|
||||||
left: newPos,
|
left: newPos,
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
bind:this={donateList}
|
bind:this={donateList}
|
||||||
on:wheel={() => {
|
on:wheel={() => {
|
||||||
const currentPos = donateList.scrollLeft;
|
const currentPos = donateList.scrollLeft;
|
||||||
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width;
|
const maxPos = donateList.scrollWidth - donateList.getBoundingClientRect().width - 5;
|
||||||
showLeftScroll = currentPos > 0;
|
showLeftScroll = currentPos > 0;
|
||||||
showRightScroll = currentPos < maxPos && currentPos !== maxPos;
|
showRightScroll = currentPos < maxPos && currentPos !== maxPos;
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue