Skip to content

Commit

Permalink
Merge pull request #5370 from camptocamp/GSEPF-297_fix-macOS
Browse files Browse the repository at this point in the history
Add Cmd key for orthogonality on MacOS
  • Loading branch information
llienher authored Dec 17, 2019
2 parents 26e1e88 + 90ad1e1 commit 0315230
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion contribs/gmf/src/editing/Snapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ class CustomSnap extends olInteractionSnap {
constructor(options) {
super(options);
document.body.addEventListener('keydown', (evt) => {
this.setActive(evt.keyCode !== 17); // Ctrl key
const SafariModifierNotPressed = !evt.metaKey; // Cmd key (MacOS)
const CtrlModifierNotPressed = evt.keyCode !== 17; // Ctrl key
this.setActive(CtrlModifierNotPressed && SafariModifierNotPressed);
});
document.body.addEventListener('keyup', () => {
this.setActive(true);
Expand Down
4 changes: 3 additions & 1 deletion src/interaction/MeasureLength.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const exports = function(format, gettextCatalog, options = /** @type {ngeox.inte
if (modifierPressed === undefined) {
modifierPressed = false;
document.body.addEventListener('keydown', (evt) => {
modifierPressed = evt.keyCode === 17; // Ctrl key
const SafariModifierPressed = !!evt.metaKey; // Cmd Key (MacOS)
const ctrlModifierPressed = evt.keyCode === 17; // Ctrl key
modifierPressed = SafariModifierPressed || ctrlModifierPressed;
});
document.body.addEventListener('keyup', () => {
modifierPressed = false;
Expand Down

0 comments on commit 0315230

Please sign in to comment.