mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-03-13 22:50:01 -04:00
Only cut if something is selected
This commit is contained in:
parent
78af17cccf
commit
8a886a7b73
1 changed files with 7 additions and 4 deletions
|
@ -8,7 +8,7 @@ import CopyPasteHOC from './copy-paste-hoc.jsx';
|
|||
|
||||
import {selectAllBitmap} from '../helper/bitmap';
|
||||
import {clearSelection, deleteSelection, getSelectedLeafItems,
|
||||
selectAllItems, selectAllSegments} from '../helper/selection';
|
||||
selectAllItems, selectAllSegments, getSelectedRootItems} from '../helper/selection';
|
||||
import {groupSelection, shouldShowGroup, ungroupSelection, shouldShowUngroup} from '../helper/group';
|
||||
import {clearSelectedItems, setSelectedItems} from '../reducers/selected-items';
|
||||
import {changeMode} from '../reducers/modes';
|
||||
|
@ -64,9 +64,12 @@ const KeyboardShortcutsHOC = function (WrappedComponent) {
|
|||
this.changeToASelectMode();
|
||||
this.props.onPasteFromClipboard();
|
||||
} else if (event.key === 'x') {
|
||||
this.props.onCopyToClipboard();
|
||||
if (deleteSelection(this.props.mode, this.props.onUpdateImage)) {
|
||||
this.props.setSelectedItems(this.props.format);
|
||||
const selectedItems = getSelectedRootItems();
|
||||
if (selectedItems.length > 0) {
|
||||
this.props.onCopyToClipboard();
|
||||
if (deleteSelection(this.props.mode, this.props.onUpdateImage)) {
|
||||
this.props.setSelectedItems(this.props.format);
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
} else if (event.key === 'a') {
|
||||
|
|
Loading…
Reference in a new issue