Skip to content

Commit

Permalink
Merge pull request #4 from Im-Rises/develop
Browse files Browse the repository at this point in the history
Deactivated styles aand added parameters tos et them
  • Loading branch information
Im-Rises committed Sep 17, 2023
2 parents 534e233 + 7970eea commit 42f67b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nbody-simulator-react-barnes-hut-react-p5",
"private": false,
"version": "0.5.7",
"version": "0.6.0",
"type": "module",
"license": "MIT",
"repository": {
Expand Down
10 changes: 8 additions & 2 deletions src/components/NbodySimulatorBarnesHut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type Props = {
softening: number;
showQuadtree: boolean;
backgroundColor: Color;
divStyle?: string;
canvasStyle?: string;
}

const defaultProps: Props = {
Expand All @@ -38,7 +40,9 @@ const defaultProps: Props = {
G: 1,
softening: 10,
showQuadtree: false,
backgroundColor: new Color(100, 100, 100)
backgroundColor: new Color(100, 100, 100),
divStyle: "",
canvasStyle: ""
}

const NbodySimulatorBarnesHut = (props: Props) => {
Expand All @@ -56,8 +60,10 @@ const NbodySimulatorBarnesHut = (props: Props) => {
}

const setup = (p5: p5Types, canvasParentRef: Element) => {
p5.createCanvas(mergedProps.widthHeight, mergedProps.widthHeight).parent(canvasParentRef);
const canvas = p5.createCanvas(mergedProps.widthHeight, mergedProps.widthHeight).parent(canvasParentRef);
p5.frameRate(60);
canvas.attribute("style", mergedProps.canvasStyle!);
canvasParentRef.setAttribute("style", mergedProps.divStyle!);
};

const draw = (p5: p5Types) => {
Expand Down

0 comments on commit 42f67b9

Please sign in to comment.