mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add select all to workflow editor
This commit is contained in:
parent
2514af79a0
commit
165c57c001
@ -26,6 +26,7 @@ import {
|
|||||||
edgesDeleted,
|
edgesDeleted,
|
||||||
nodesChanged,
|
nodesChanged,
|
||||||
nodesDeleted,
|
nodesDeleted,
|
||||||
|
selectedAll,
|
||||||
selectedEdgesChanged,
|
selectedEdgesChanged,
|
||||||
selectedNodesChanged,
|
selectedNodesChanged,
|
||||||
selectionCopied,
|
selectionCopied,
|
||||||
@ -124,11 +125,18 @@ export const Flow = () => {
|
|||||||
dispatch(contextMenusClosed());
|
dispatch(contextMenusClosed());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
useHotkeys(['Ctrl+c', 'Meta+c'], () => {
|
useHotkeys(['Ctrl+c', 'Meta+c'], (e) => {
|
||||||
|
e.preventDefault();
|
||||||
dispatch(selectionCopied());
|
dispatch(selectionCopied());
|
||||||
});
|
});
|
||||||
|
|
||||||
useHotkeys(['Ctrl+v', 'Meta+v'], () => {
|
useHotkeys(['Ctrl+a', 'Meta+a'], (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
dispatch(selectedAll());
|
||||||
|
});
|
||||||
|
|
||||||
|
useHotkeys(['Ctrl+v', 'Meta+v'], (e) => {
|
||||||
|
e.preventDefault();
|
||||||
dispatch(selectionPasted());
|
dispatch(selectionPasted());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -612,6 +612,16 @@ const nodesSlice = createSlice({
|
|||||||
) => {
|
) => {
|
||||||
state.mouseOverField = action.payload;
|
state.mouseOverField = action.payload;
|
||||||
},
|
},
|
||||||
|
selectedAll: (state) => {
|
||||||
|
state.nodes = applyNodeChanges(
|
||||||
|
state.nodes.map((n) => ({ id: n.id, type: 'select', selected: true })),
|
||||||
|
state.nodes
|
||||||
|
);
|
||||||
|
state.edges = applyEdgeChanges(
|
||||||
|
state.edges.map((e) => ({ id: e.id, type: 'select', selected: true })),
|
||||||
|
state.edges
|
||||||
|
);
|
||||||
|
},
|
||||||
selectionCopied: (state) => {
|
selectionCopied: (state) => {
|
||||||
state.nodesToCopy = state.nodes.filter((n) => n.selected).map(cloneDeep);
|
state.nodesToCopy = state.nodes.filter((n) => n.selected).map(cloneDeep);
|
||||||
state.edgesToCopy = state.edges.filter((e) => e.selected).map(cloneDeep);
|
state.edgesToCopy = state.edges.filter((e) => e.selected).map(cloneDeep);
|
||||||
@ -801,6 +811,7 @@ export const {
|
|||||||
mouseOverFieldChanged,
|
mouseOverFieldChanged,
|
||||||
selectionCopied,
|
selectionCopied,
|
||||||
selectionPasted,
|
selectionPasted,
|
||||||
|
selectedAll,
|
||||||
} = nodesSlice.actions;
|
} = nodesSlice.actions;
|
||||||
|
|
||||||
export default nodesSlice.reducer;
|
export default nodesSlice.reducer;
|
||||||
|
Loading…
Reference in New Issue
Block a user