2024-12-15 21:19:09 -05:00
|
|
|
import { PainterContext, SquareCanvas } from "../src/Canvas";
|
|
|
|
import { useContext, useEffect } from "react";
|
2024-11-29 23:19:19 -05:00
|
|
|
|
2024-12-15 21:19:09 -05:00
|
|
|
export function Render({ f }) {
|
|
|
|
const { width, height, setPainter } = useContext(PainterContext);
|
|
|
|
useEffect(() => {
|
|
|
|
if (width && height) {
|
|
|
|
const painter = f({ width, height });
|
|
|
|
setPainter(painter);
|
|
|
|
}
|
|
|
|
}, [width, height]);
|
|
|
|
return <></>;
|
2024-11-29 23:19:19 -05:00
|
|
|
}
|
|
|
|
|
2024-12-15 21:19:09 -05:00
|
|
|
export default function Gasket({ f }) {
|
|
|
|
return (
|
|
|
|
<SquareCanvas name={"gasket"}>
|
|
|
|
<Render f={f} />
|
|
|
|
</SquareCanvas>
|
|
|
|
);
|
2024-11-29 23:19:19 -05:00
|
|
|
}
|