Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed May 24, 2024
1 parent 3861a99 commit a7cd64f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const center = (d: HTMLDivElement) => {
return box.left + box.width / 2;
};

const SCROLL_FAC_NEAR = 1 / 1000;
const SCROLL_FAC_NEAR = 3;

export function Gallery() {
const paper = usePaper();
Expand Down Expand Up @@ -75,7 +75,7 @@ export function Gallery() {
const a = basis - positions.get(c) + ref.scrollLeft;
c.style.setProperty(
"--factor-near",
`${clamp(-((a * SCROLL_FAC_NEAR) ** 2) + 1, 0, 1)}`
`${clamp(-(((a * SCROLL_FAC_NEAR) / innerWidth) ** 2) + 1, 0, 1)}`
);
c.style.setProperty("--factor", `${a}`);
});
Expand Down Expand Up @@ -115,6 +115,7 @@ export function Gallery() {
(e.target as HTMLDivElement).scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center",
});
}}
sx={{
Expand Down Expand Up @@ -188,6 +189,7 @@ export function Gallery() {
(e.target as HTMLDivElement).scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center",
});
}}
sx={{
Expand Down Expand Up @@ -230,12 +232,14 @@ export function Gallery() {
right: 0,
opacity: `var(--factor-near)`,
backgroundColor: "#0a0c1099",
pointerEvents: "none",
}}
></Box>
) : (
<Box
sx={{
position: "absolute",
pointerEvents: "none",
width: "100%",
aspectRatio: 16 / 10,
maxWidth: 720,
Expand Down

0 comments on commit a7cd64f

Please sign in to comment.