Skip to content

Commit

Permalink
More structured way of handling mac ctrl-click
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jul 20, 2012
1 parent d2a1825 commit 8da3a26
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -2995,11 +2995,14 @@ var CodeMirror = (function() {

function e_target(e) {return e.target || e.srcElement;}
function e_button(e) {
if (mac && e.ctrlKey && e.which === 1) return 3;
else if (e.which) return e.which;
else if (e.button & 1) return 1;
else if (e.button & 2) return 3;
else if (e.button & 4) return 2;
var b = e.which;
if (b == null) {
if (e.button & 1) b = 1;
else if (e.button & 2) b = 3;
else if (e.button & 4) b = 2;
}
if (mac && e.ctrlKey && b == 1) b = 3;
return b;
}

// Allow 3rd-party code to override event properties by adding an override
Expand Down

0 comments on commit 8da3a26

Please sign in to comment.