Skip to content

Commit c8aeb96

Browse files
authored
Merge branch 'ControlCore-Project:main' into author_fix
2 parents cb64e79 + 854fa5d commit c8aeb96

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/toolbarActions/toolbarFunctions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ const editElement = (state, setState) => {
6868
}
6969
};
7070

71-
const deleteElem = (state) => {
71+
const deleteElem = (state, dispatcher) => {
7272
const tid = new Date().getTime();
7373
state.eleSelectedPayload.ids.forEach((id) => getGraphFun(state).deleteElem(id, tid));
74-
// eslint-disable-next-line
75-
state.eleSelectedPayload.type = 'MIX';
74+
dispatcher({ type: T.ELE_UNSELECTED, payload: null });
7675
};
7776

7877
const downloadImg = (state, setState, format) => {

src/toolbarActions/toolbarList.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const toolbarList = (state, dispatcher) => [
6565
text: 'Empty',
6666
icon: FaThermometerEmpty,
6767
action: clearAll,
68-
active: true,
68+
active: state.curGraphInstance,
6969
visibility: true,
7070
hotkey: 'Ctrl+Backspace',
7171
},
@@ -94,15 +94,15 @@ const toolbarList = (state, dispatcher) => [
9494
text: 'Edit',
9595
icon: FaEdit,
9696
action: editElement,
97-
active: (state.eleSelected && state.eleSelectedPayload.type !== 'MIX'),
97+
active: state.curGraphInstance && state.eleSelected,
9898
visibility: true,
9999
hotkey: 'Ctrl+E',
100100
},
101101
{
102102
type: 'action',
103103
text: 'Delete',
104104
icon: FaTrash,
105-
action: deleteElem,
105+
action: () => deleteElem(state, dispatcher),
106106
active: state.eleSelected,
107107
visibility: true,
108108
hotkey: 'Delete,Backspace,Del,Clear',

0 commit comments

Comments
 (0)