Commit a0c9dec
authored
fix(caret): caret not resetting position on quick restart (@nadalaba) (monkeytypegame#7038)
- quick restarting immediately after some input makes the caret fail to
reset its position sometimes.
https://github.com/user-attachments/assets/d9e1def5-d8f6-4af2-845c-778c89279849
this happens because the reset of caret's position that should happen on
the callback inside `requestAnimationFrame` in `caret.goTo()` (triggered
in `TestUI.updateWordsWrapperClasses()`) is cancelled by a later call to
`caret.goTo()` (triggered by `TestUI.focusWords()`). However the second
call sets the position directly without stopping previous animation
`$('#caret').stop().animate()`. As a result, the earlier animation
(caused by last input) continues after the reset, if the restart was
done fast enough.
- update some previous comments.1 parent 4222766 commit a0c9dec
2 files changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
157 | | - | |
158 | | - | |
159 | | - | |
| 160 | + | |
| 161 | + | |
160 | 162 | | |
161 | | - | |
162 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
| |||
0 commit comments