Skip to content

Commit

Permalink
Adjust Shortcut Functions
Browse files Browse the repository at this point in the history
  • Loading branch information
wgranger committed Nov 29, 2017
1 parent baf8581 commit fd03966
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/KeyboardShortcuts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const KeyboardShortcuts = () => {
<td>Toggle Previous Marks</td>
</tr>
<tr>
<td>Ctrl + N</td>
<td>Ctrl + A</td>
<td>Toggle Navigate and Annotate</td>
</tr>
<tr>
Expand Down
13 changes: 10 additions & 3 deletions src/components/SelectedAnnotation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,13 @@ class SelectedAnnotation extends React.Component {

handleKeyUp(e) {
if (Utility.getKeyCode(e) === KEY_CODES.ESCAPE) {
this.props.onClose && this.props.onClose();
this.cancelAnnotation();
}
if (Utility.getKeyCode(e) === KEY_CODES.ENTER && e.ctrlKey) {
this.saveText();
if (Utility.getKeyCode(e) === KEY_CODES.ENTER) {
const wordCountMatchesDots = this.doesWordCountMatchDots(this.state.annotationText, this.props.selectedAnnotation.points.length);
if (wordCountMatchesDots) {
this.saveText();
}
}
}

Expand All @@ -345,6 +348,7 @@ SelectedAnnotation.defaultProps = {
},
rotation: 0,
scaling: 1,
selectedAnnotation: null,
translationX: 0,
translationY: 0,
viewerSize: {
Expand All @@ -362,6 +366,9 @@ SelectedAnnotation.propTypes = {
onClose: PropTypes.func,
rotation: PropTypes.number,
scaling: PropTypes.number,
selectedAnnotation: PropTypes.shape({
points: PropTypes.array,
}),
selectedAnnotationIndex: PropTypes.number,
translationX: PropTypes.number,
translationY: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ClassifierContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class ClassifierContainer extends React.Component {
}

handleKeyUp(e) {
if (Utility.getKeyCode(e) === KEY_CODES.N && e.ctrlKey) {
if (Utility.getKeyCode(e) === KEY_CODES.A && e.ctrlKey) {
if (this.props.viewerState === SUBJECTVIEWER_STATE.NAVIGATING && !this.props.selectedAnnotation) {
this.props.dispatch(setViewerState(SUBJECTVIEWER_STATE.ANNOTATING));
} else {
Expand Down

0 comments on commit fd03966

Please sign in to comment.