fixed annoying bug where the trigger disappears when you edit

This commit is contained in:
ari committed 2022-01-14 11:38:08 -05:00
1 parent 9d13785985
commit 7296a2c518
4 files changed
+3 -6

No files matched your search

@@ -75,7 +75,7 @@ export const AutomationEditor: FC<Props> = ({
dims={dims} dims={dims}
sequence={automation.sequence} sequence={automation.sequence}
onChange={updateSequence} onChange={updateSequence}
additionalElements={chain([ additionalElements={() => chain([
computeExtraField([1, 0.5], [2, 0.5]), computeExtraField([1, 0.5], [2, 0.5]),
computeTriggerPos( computeTriggerPos(
[0.5, 0.5], [0.5, 0.5],
@@ -27,12 +27,9 @@ export const AutomationList: FC<AutomationListParams> = ({
children, children,
}) => { }) => {
// state // state
// const [searchParams, setSearchParams] = useSearchParams();
const [hideList, setHideList] = useState(false); const [hideList, setHideList] = useState(false);
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
// alias // alias
// const current = Number(searchParams.get("current") ?? "0");
// const setCurrent = (i: number) => setSearchParams({ current: String(i) });
const currentAuto = automations.length > 0 ? automations[current] : null; const currentAuto = automations.length > 0 ? automations[current] : null;
const automationListListCls = "automation-list--list" + (hideList ? " hide" : " show") const automationListListCls = "automation-list--list" + (hideList ? " hide" : " show")
// render // render
@@ -60,7 +60,7 @@ export const SequenceNodes: FC<SequenceNodeProps & { zoomLevel: number }> = (pro
s => setModalState(s) s => setModalState(s)
); );
if (props.additionalElements) { if (props.additionalElements) {
elmIter = chain([elmIter, props.additionalElements]); elmIter = chain([elmIter, props.additionalElements()]);
} }
// render // render
+1 -1
View File
@@ -11,7 +11,7 @@ export interface SequenceNodeProps {
dims: DAGBoardElmDims; dims: DAGBoardElmDims;
sequence: AutomationSequenceNode[], sequence: AutomationSequenceNode[],
onChange: (s: AutomationSequenceNode[]) => void; onChange: (s: AutomationSequenceNode[]) => void;
additionalElements?: Generator<DAGElement>; additionalElements?: () => Generator<DAGElement>;
} }
export type ModalState = { export type ModalState = {