From 0fc9fd151d0cefca4fb9540d6607b4e24d74cd45 Mon Sep 17 00:00:00 2001 From: DD Date: Wed, 20 Dec 2017 15:15:45 -0500 Subject: [PATCH] Set enabled state based on whether any points are selected --- src/components/mode-tools/mode-tools.jsx | 3 +++ src/containers/mode-tools.jsx | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/mode-tools/mode-tools.jsx b/src/components/mode-tools/mode-tools.jsx index 29dd333d..d46cf71f 100644 --- a/src/components/mode-tools/mode-tools.jsx +++ b/src/components/mode-tools/mode-tools.jsx @@ -95,12 +95,14 @@ const ModeToolsComponent = props => { return (
0) { @@ -50,6 +62,7 @@ class ModeTools extends React.Component { render () { return ( @@ -63,13 +76,16 @@ ModeTools.propTypes = { incrementPasteOffset: PropTypes.func.isRequired, onUpdateSvg: PropTypes.func.isRequired, pasteOffset: PropTypes.number, + // Listen on selected items to update hasSelectedPoints + selectedItems: PropTypes.arrayOf(PropTypes.instanceOf(paper.Item)), // eslint-disable-line react/no-unused-prop-types setClipboardItems: PropTypes.func.isRequired, setSelectedItems: PropTypes.func.isRequired }; const mapStateToProps = state => ({ clipboardItems: state.scratchPaint.clipboard.items, - pasteOffset: state.scratchPaint.clipboard.pasteOffset + pasteOffset: state.scratchPaint.clipboard.pasteOffset, + selectedItems: state.scratchPaint.selectedItems }); const mapDispatchToProps = dispatch => ({ setClipboardItems: items => {