mirror of
https://github.com/bspeice/speice.io
synced 2025-07-05 07:44:54 -04:00
Use a sizing ref to avoid resizing the canvas
This commit is contained in:
@ -4,11 +4,10 @@ import {PainterContext} from "../src/Canvas";
|
||||
import {chaosGameHistogram} from "./chaosGameHistogram";
|
||||
|
||||
type Props = {
|
||||
quality?: number;
|
||||
paint: (width: number, histogram: Uint32Array) => ImageData;
|
||||
paint: (width: number, height: number, histogram: number[]) => ImageData;
|
||||
children?: React.ReactElement;
|
||||
}
|
||||
export default function FlameHistogram({quality, paint, children}: Props) {
|
||||
export default function FlameHistogram({paint, children}: Props) {
|
||||
const {width, height, setPainter} = useContext(PainterContext);
|
||||
|
||||
useEffect(() => {
|
||||
@ -17,11 +16,10 @@ export default function FlameHistogram({quality, paint, children}: Props) {
|
||||
height,
|
||||
transforms,
|
||||
final,
|
||||
quality,
|
||||
paint
|
||||
}
|
||||
setPainter(chaosGameHistogram(gameParams));
|
||||
}, []);
|
||||
}, [width, height]);
|
||||
|
||||
return children;
|
||||
}
|
Reference in New Issue
Block a user