added root styles
added auto editor cleaned up styles for dagboard
This commit is contained in:
1 parent
fff15f65ce
commit
1efb04fe68
11 files changed
+328
-36
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import { DAGBoardElmDims } from "components/DAGSvgs/DAGBoard";
|
||||
import { SequenceNodes } from "components/SequenceNodes";
|
||||
import { FC } from "react";
|
||||
import { AutomationData, AutomationSequenceNode } from "types/automations";
|
||||
import useWindowSize from "utils/useWindowSize";
|
||||
import { AutoInfoBox } from "./AutoInfoBox";
|
||||
import { useEditorStyles } from "./styles";
|
||||
|
||||
|
||||
interface Props {
|
||||
automation: AutomationData;
|
||||
dims: DAGBoardElmDims;
|
||||
onUpdate: (auto: AutomationData) => void;
|
||||
}
|
||||
export const AutomationEditor: FC<Props> = ({
|
||||
dims,
|
||||
automation,
|
||||
onUpdate,
|
||||
}) => {
|
||||
// state
|
||||
const { ratioWbh } = useWindowSize();
|
||||
const { classes } = useEditorStyles({});
|
||||
|
||||
// alias
|
||||
// const nHDF = 1.5 // node horizontal distance factor (aspect ratio)
|
||||
// const graphHeight = 300;
|
||||
// const graphWidth = Math.round(graphHeight * ratioWbh);
|
||||
const updateSequence = (sequence: AutomationSequenceNode[]) => onUpdate({
|
||||
...automation,
|
||||
sequence,
|
||||
});
|
||||
|
||||
// render
|
||||
return <div className={classes.root} style={{
|
||||
flexDirection: ratioWbh >= 0.75 ? 'row' : 'column'
|
||||
}}>
|
||||
<AutoInfoBox
|
||||
className={classes.infoBox}
|
||||
metadata={automation.metadata}
|
||||
onUpdate={metadata => onUpdate({ ...automation, metadata })}
|
||||
/>
|
||||
<SequenceNodes
|
||||
zoomLevel={1.5}
|
||||
startPoint={[0.5, 0.5]}
|
||||
dims={dims}
|
||||
sequence={automation.sequence}
|
||||
onChange={updateSequence}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
Reference in new issue
Block a user