Skip to content

Commit

Permalink
put controls back into the graph-editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Jul 20, 2023
1 parent 722e837 commit fc7d3d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/HowToCreateNewValueTypesAndNodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TODO

How to create new value types, like a "Character" and how to make a "Move Character" node that uses the Character type.
10 changes: 9 additions & 1 deletion packages/flow/src/components/Controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ import { HelpModal } from './modals/HelpModal.js';
import { Examples, LoadModal } from './modals/LoadModal.js';
import { SaveModal } from './modals/SaveModal.js';

export const CustomControls = ({
export type CustomControlsProps = {
playing: boolean;
togglePlay: () => void;
setBehaviorGraph: (value: GraphJSON) => void;
examples: Examples;
specJson: NodeSpecJSON[] | undefined;
};

export const CustomControls: React.FC<CustomControlsProps> = ({
playing,
togglePlay,
setBehaviorGraph,
Expand Down
8 changes: 8 additions & 0 deletions packages/flow/src/components/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useGraphRunner } from '../hooks/useGraphRunner.js';
import { useNodeSpecJson } from '../hooks/useNodeSpecJson.js';
import { Examples } from './modals/LoadModal.js';
import { NodePicker } from './NodePicker.js';
import CustomControls from './Controls.js';

type FlowProps = {
initialGraph: GraphJSON;
Expand Down Expand Up @@ -84,6 +85,13 @@ export const Flow: FC<FlowProps> = ({ initialGraph: graph, examples }) => {
onPaneClick={handlePaneClick}
onPaneContextMenu={handlePaneContextMenu}
>
<CustomControls
playing={playing}
togglePlay={togglePlay}
setBehaviorGraph={setGraphJson}
examples={examples}
specJson={specJson}
/>
<Background
variant={BackgroundVariant.Lines}
color="#2a2b2d"
Expand Down

0 comments on commit fc7d3d1

Please sign in to comment.