fix: highlighting error

This commit is contained in:
Felix Roos 2022-11-13 18:44:00 +01:00
parent 7ab263b514
commit 2341452d91
2 changed files with 13 additions and 9 deletions

View file

@ -47,5 +47,5 @@ currently broken / buggy:
- => draw was choppy + that also caused useHighlighting bugs - => draw was choppy + that also caused useHighlighting bugs
- [x] pianoroll keeps rolling when pressing stop - [x] pianoroll keeps rolling when pressing stop
- [x] find a way to display errors when console is closed / another tab selected - [x] find a way to display errors when console is closed / another tab selected
- [ ] highlighting out of range error is back (delete large chunk at the top while highlighting below is triggered) - [x] highlighting out of range error is back (delete large chunk at the top while highlighting below is triggered)
- [ ] idea: interpolate between running and evaluated code! - [ ] idea: interpolate between running and evaluated code!

View file

@ -173,10 +173,17 @@ function App() {
// UI Actions // UI Actions
// //
const handleChangeCode = (c) => { const handleChangeCode = useCallback(
setCode(c); (c) => {
started && logger('[edit] code changed. hit ctrl+enter to update'); setCode(c);
}; started && logger('[edit] code changed. hit ctrl+enter to update');
},
[started],
);
const handleSelectionChange = useCallback((selection) => {
// TODO: scroll to selected function in reference
// console.log('selectino change', selection.ranges[0].from);
}, []);
const handleTogglePlay = async () => { const handleTogglePlay = async () => {
await getAudioContext().resume(); // fixes no sound in ios webkit await getAudioContext().resume(); // fixes no sound in ios webkit
if (!started) { if (!started) {
@ -259,10 +266,7 @@ function App() {
value={code} value={code}
onChange={handleChangeCode} onChange={handleChangeCode}
onViewChanged={setView} onViewChanged={setView}
onSelectionChange={(selection) => { onSelectionChange={handleSelectionChange}
// TODO: scroll to selected function in reference
// console.log('selectino change', selection.ranges[0].from);
}}
/> />
</section> </section>
{error && ( {error && (