Skip to content

Commit

Permalink
chore: another test for cursor binding (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored May 23, 2024
1 parent f4a646f commit e6a260e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Control {

// testing for braille cursor routing
constants.events.push([
constants.brailleInput,
documnent,
'selectionchange',
function (e) {
const selection = document.getSelection();
Expand All @@ -289,17 +289,20 @@ class Control {
console.log('Testing cursor routing');
console.log('Selection:', selection);
console.log('Offset:', offset);
console.log('Target:', e.target);

position.x = offset;
updateInfoThisRound = true;
isAtEnd = lockPosition();
if ((e.target = constants.brailleInput)) {
position.x = offset;
updateInfoThisRound = true;
isAtEnd = lockPosition();

// update display / text / audio
if (updateInfoThisRound && !isAtEnd) {
UpdateAll();
}
if (isAtEnd) {
audio.playEnd();
// update display / text / audio
if (updateInfoThisRound && !isAtEnd) {
UpdateAll();
}
if (isAtEnd) {
audio.playEnd();
}
}
},
]);
Expand Down

0 comments on commit e6a260e

Please sign in to comment.