Skip to content

Commit

Permalink
optimise
Browse files Browse the repository at this point in the history
  • Loading branch information
HauseMasterZ committed Sep 10, 2023
1 parent 67939e4 commit 22c71a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,13 +669,13 @@ function applyCustomText(event) {

function updateCursorPosition() {
letterRects = [];
for (let index = 0; index < words.length; index++) {
words.forEach((word) => {
let lettersRects = [];
words[index].querySelectorAll('letter').forEach(letter => {
word.querySelectorAll("letter").forEach((letter) => {
lettersRects.push(letter.getClientRects());
});
letterRects.push(lettersRects);
}
});
const letterRect = latestWord
? letterRects[currentWordIndex][latestWord.length - 1][0]
: letterRects[currentWordIndex][0][0];
Expand Down

0 comments on commit 22c71a3

Please sign in to comment.