Skip to content

Commit

Permalink
Fix issue allowing multi selection of events from different paths in …
Browse files Browse the repository at this point in the history
…conditionals
  • Loading branch information
chrismaltby committed Apr 30, 2024
1 parent ddff6ab commit a8f27c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/store/features/editor/editorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,15 @@ const toggleScriptEventSelectedId =
);
const selectionIds = state.editor.scriptEventSelectionIds.slice();
const selectionParentId = state.editor.scriptEventSelectionParentId;
const parentId = `${action.parentType}_${action.parentId}_${action.parentKey}`;

if (siblingIds) {
if (selectionParentId !== action.parentId) {
if (selectionParentId !== parentId) {
// Selected from new parent, change selection to just this script event
dispatch(
actions.setScriptEventSelectedId({
actions.setScriptEventSelectedIds({
scriptEventIds: [action.scriptEventId],
parentId: action.parentId,
parentId,
})
);
} else {
Expand All @@ -271,9 +272,9 @@ const toggleScriptEventSelectedId =
return indexA - indexB;
});
dispatch(
actions.setScriptEventSelectedId({
actions.setScriptEventSelectedIds({
scriptEventIds: sortedIds,
parentId: action.parentId,
parentId,
})
);
}
Expand Down Expand Up @@ -820,7 +821,7 @@ const editorSlice = createSlice({
state.sceneSelectionIds = [];
},

setScriptEventSelectedId: (
setScriptEventSelectedIds: (
state,
action: PayloadAction<{ scriptEventIds: string[]; parentId: string }>
) => {
Expand Down
2 changes: 1 addition & 1 deletion test/store/features/editor/editorState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ test("Should allow setting selected script events", () => {
scriptEventSelectionIds: [],
scriptEventSelectionParentId: "",
};
const action = actions.setScriptEventSelectedId({
const action = actions.setScriptEventSelectedIds({
scriptEventIds: ["b", "c", "d"],
parentId: "a",
});
Expand Down

0 comments on commit a8f27c7

Please sign in to comment.