Skip to content

Commit

Permalink
chore: changing to simple selection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix committed Jun 12, 2024
1 parent 05908db commit 6563d94
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,21 @@ class Control {
// testing for braille cursor routing
document.addEventListener('selectionchange', function (e) {
const selection = document.getSelection();
let offset = selection.anchorOffset;
console.log('Testing cursor routing', new Date().getTime());
if (selection.anchorNode == constants.brailleInput) {
console.log("We're in braille input");
let pos = constants.brailleInput.selectionStart;
console.log('Position: ', pos);
position.x = pos;
let testEnd = lockPosition();

console.log('Testing cursor routing');
console.log('Selection:', selection);
console.log('Target:', selection.anchorNode);
console.log('Offset:', offset);
console.log('Target:', e.target);

position.x = offset;
let testUpdate = true;
let testEnd = lockPosition();

// update display / text / audio
if (testUpdate && !testEnd) {
UpdateAll();
}
if (testEnd) {
audio.playEnd();
// update display / text / audio
if (testEnd) {
UpdateAll();
}
if (testEnd) {
audio.playEnd();
}
}
});

Expand Down

0 comments on commit 6563d94

Please sign in to comment.