Skip to content

Commit

Permalink
Issue nlplab#965 (Mac Cmd key support, for real now)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goran Topic committed Nov 14, 2012
1 parent f354767 commit 5047e2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions client/src/annotator_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var AnnotatorUI = (function($, window, undefined) {
if (evt.altKey) {
prefix = "A-";
}
if (evt.ctrlKey) {
if (Util.isMac ? evt.metaKey : evt.ctrlKey) {
prefix = "C-";
}
if (evt.shiftKey) {
Expand Down Expand Up @@ -1529,7 +1529,7 @@ var AnnotatorUI = (function($, window, undefined) {
return;
}

if (arcDragJustStarted && (evt.altKey || evt.ctrlKey)) {
if (arcDragJustStarted && (Util.isMac ? evt.metaKey : evt.ctrlKey)) {
// is it arc drag start (with ctrl or alt)? do nothing special

} else if (arcDragOrigin) {
Expand Down Expand Up @@ -1558,7 +1558,7 @@ var AnnotatorUI = (function($, window, undefined) {
dispatcher.post('logAction', ['arcSelected']);
}
}
} else if (!(evt.ctrlKey || evt.altKey) {
} else if (!(Util.isMac ? evt.metaKey : evt.ctrlKey)) {
// if not, then is it span selection? (ctrl key cancels)
var sel = window.getSelection();
var chunkIndexFrom = sel.anchorNode && $(sel.anchorNode.parentNode).attr('data-chunk-id');
Expand Down
8 changes: 4 additions & 4 deletions client/src/visualizer_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ var VisualizerUI = (function($, window, undefined) {
currentForm.trigger('submit');
return false;
}
} else if (evt.ctrlKey &&
} else if ((Util.isMac ? evt.metaKey : evt.ctrlKey) &&
(code == 'F'.charCodeAt(0) || code == 'G'.charCodeAt(0))) {
// prevent Ctrl-F/Ctrl-G in forms
evt.preventDefault();
Expand All @@ -1449,13 +1449,13 @@ var VisualizerUI = (function($, window, undefined) {
autoPaging(true);
} else if (evt.shiftKey && code === $.ui.keyCode.DOWN) {
autoPaging(false);
} else if (evt.ctrlKey && code == 'F'.charCodeAt(0)) {
} else if ((Util.isMac ? evt.metaKey : evt.ctrlKey) && code == 'F'.charCodeAt(0)) {
evt.preventDefault();
showSearchForm();
} else if (searchActive && evt.ctrlKey && code == 'G'.charCodeAt(0)) {
} else if (searchActive && (Util.isMac ? evt.metaKey : evt.ctrlKey) && code == 'G'.charCodeAt(0)) {
evt.preventDefault();
return moveInFileBrowser(+1);
} else if (searchActive && evt.ctrlKey && code == 'K'.charCodeAt(0)) {
} else if (searchActive && (Util.isMac ? evt.metaKey : evt.ctrlKey) && code == 'K'.charCodeAt(0)) {
evt.preventDefault();
clearSearchResults();
}
Expand Down

0 comments on commit 5047e2c

Please sign in to comment.