shouldShow checks added

This commit is contained in:
Jacco Kulman 2020-06-21 09:57:27 +02:00
parent b94a2addf3
commit 78af17cccf

View file

@ -9,7 +9,7 @@ import CopyPasteHOC from './copy-paste-hoc.jsx';
import {selectAllBitmap} from '../helper/bitmap';
import {clearSelection, deleteSelection, getSelectedLeafItems,
selectAllItems, selectAllSegments} from '../helper/selection';
import {groupSelection, ungroupSelection} from '../helper/group';
import {groupSelection, shouldShowGroup, ungroupSelection, shouldShowUngroup} from '../helper/group';
import {clearSelectedItems, setSelectedItems} from '../reducers/selected-items';
import {changeMode} from '../reducers/modes';
@ -49,10 +49,14 @@ const KeyboardShortcutsHOC = function (WrappedComponent) {
} else if (event.key === 'z') {
this.props.onUndo();
} else if (event.shiftKey && event.key.toLowerCase() === 'g') {
if (shouldShowUngroup()) {
ungroupSelection(clearSelectedItems, setSelectedItems, this.props.onUpdateImage);
}
event.preventDefault();
} else if (event.key === 'g') {
if (shouldShowGroup()) {
groupSelection(clearSelectedItems, setSelectedItems, this.props.onUpdateImage);
}
event.preventDefault();
} else if (event.key === 'c') {
this.props.onCopyToClipboard();