Skip to content

Commit

Permalink
fix: scrolling through canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
dan1M committed Oct 24, 2024
1 parent 076be34 commit c2ea8fa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions webapp/src/components/landing/PartnerSectionWithPhysics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const PartnerSectionWithPhysics = ({}: PartnerSectionProps) => {
return { body, element: html_element }; // Returns the body and the DOM element
});

const innerOffset = 45;
const innerOffset = 50;
const wallsOptions: IChamferableBodyDefinition = {
isStatic: true,
friction: 1,
Expand Down Expand Up @@ -166,7 +166,6 @@ const PartnerSectionWithPhysics = ({}: PartnerSectionProps) => {
const mouse = Mouse.create(canvas);
const mouseConstraint = MouseConstraint.create(engine, {
mouse,

constraint: {
damping: 0.2,
stiffness: 1,
Expand Down Expand Up @@ -199,8 +198,6 @@ const PartnerSectionWithPhysics = ({}: PartnerSectionProps) => {
};
}, [arePhysicsTriggered]);

// TODO: Handle scroll when in canvas

return (
<Flex
flexDir={{ base: "column", lg: "row" }}
Expand All @@ -212,7 +209,14 @@ const PartnerSectionWithPhysics = ({}: PartnerSectionProps) => {
color={"white"}
mt={isDesktop ? 0 : 20}
>
<Box as="canvas" ref={canvasRef} pos={"absolute"} w={"full"} h={"full"} />
<Box
as="canvas"
ref={canvasRef}
pos={"absolute"}
w={"full"}
h={"full"}
onWheelCapture={(e: React.WheelEvent) => e.stopPropagation()}
/>
<Flex
flex={1}
flexDir="column"
Expand Down

0 comments on commit c2ea8fa

Please sign in to comment.