Skip to content

Commit

Permalink
Update position.js (#2036)
Browse files Browse the repository at this point in the history
changed all e.which in rows 250 - 266 to e.key
  • Loading branch information
JohanPihelAtWork authored Sep 6, 2024
1 parent 60bb6e2 commit 96ec88b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/controls/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,19 @@ const Position = function Position(options = {}) {
*/
function onFind(e) {
if (currentConfig.dms) {
if (e.which === 37) {
if (e.key === 'ArrowLeft') {
moveCaret(true);
} else if (e.which === 39) {
} else if (e.key === 'ArrowRight') {
moveCaret(false);
} else if (e.which >= 48 && e.which <= 57) {
inputEl.value = inputEl.value.substring(0, currentCaretPos) + (e.which - 48) + inputEl.value.substring(currentCaretPos + 1);
} else if (e.key >= 0 && e.key <= 9) {
inputEl.value = inputEl.value.substring(0, currentCaretPos) + (e.key) + inputEl.value.substring(currentCaretPos + 1);
moveCaret(false);
} else if (e.which === 13) {
} else if (e.key === 'Enter') {
findCoordinate();
}
// For DMS, we handle everything ourselves. Ignore all keypresses (including current key) in order to keep browser from interfering
e.preventDefault();
} else if (e.which === 13) {
} else if (e.key === 'Enter') {
findCoordinate();
}
}
Expand Down

0 comments on commit 96ec88b

Please sign in to comment.