Skip to content

Commit

Permalink
Merge pull request #4385 from epam/4028-macro-when-monomers-are-selec…
Browse files Browse the repository at this point in the history
…ted-del-and-backspace-hotkey-delete-selected-monomers-and-switches-to-erase-tool

#4028 - Macro: When monomers are selected Del and Backspace hotkey delete selected monomers and switches to Erase tool
  • Loading branch information
NataliaLoginova authored and Natalia_Loginova1 committed Apr 2, 2024
1 parent c4110ef commit 9af6cf2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const hotkeysConfiguration = {
// TODO create an ability to stop event propagation from mode event handlers to keyboard shortcuts handlers
if (editor.isSequenceEditMode) return;
editor.events.selectTool.dispatch('erase');
editor.events.selectTool.dispatch('select-rectangle');
},
},
clear: {
Expand Down
21 changes: 17 additions & 4 deletions packages/ketcher-macromolecules/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,23 @@ function MenuComponent() {
} else if (!['zoom-in', 'zoom-out', 'zoom-reset'].includes(name)) {
editor.events.selectTool.dispatch(name);
if (name === 'clear') {
dispatch(selectTool('select-rectangle'));
editor.events.selectTool.dispatch('select-rectangle');
} else {
dispatch(selectTool(name));
if (
name === 'erase' &&
editor.drawingEntitiesManager.selectedEntities.length
) {
dispatch(selectTool('select-rectangle'));
editor.events.selectTool.dispatch(name);
editor.events.selectTool.dispatch('select-rectangle');
} else {
dispatch(selectTool(name));
editor.events.selectTool.dispatch(name);
if (name === 'clear') {
dispatch(selectTool('select-rectangle'));
editor.events.selectTool.dispatch('select-rectangle');
} else {
dispatch(selectTool(name));
}
}
}
}
};
Expand Down

0 comments on commit 9af6cf2

Please sign in to comment.