Skip to content

Commit

Permalink
feat: add cursor routing functionality in beta mode, just for barplots (
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored Jun 16, 2024
1 parent b3c3faa commit 719c684
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/js/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,21 @@ class Control {

// testing for braille cursor routing
document.addEventListener('selectionchange', function (e) {
// notes:
// this basically works
// constants.braillInput.selectionStart is the key, and is the position,
// but it starts at 1, so we need to subtract 1 to get the actual position
// hard part is that we need to wire this through the whole script
// event is selectionchange, so we'll either need to refactor and do separate events + functions for this,
// or pull UpdateAll() etc into their own area so it can be triggered from anywhere
// ... ideally let's do that. Better yet, have a global UpdateAll, not per chart

const selection = document.getSelection();
console.log('Testing cursor routing', new Date().toLocaleTimeString());
console.log('selection: ', selection);

let pos = constants.brailleInput.selectionStart;
console.log('Position: ', pos);
position.x = pos;
position.x = pos - 1; // selection starts at 1, so we subtract 1 to get the actual position
let testEnd = lockPosition();

// update display / text / audio
Expand Down

0 comments on commit 719c684

Please sign in to comment.