diff --git a/README.md b/README.md index ad4d6d2..2c310b5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ To evaluate code, press `Ctrl+Enter` (no visible animation). This is true for ev - [x] Add a way to set the clock's time signature. - [ ] Add a way to set the clock's swing. - [ ] MIDI Clock In/Out support. - - [ ] Performance optimisations and metrics. + - [x] Performance optimisations and metrics. - [ ] Add a way to save the current universe as a file. - [ ] Add a way to load a universe from a file. - [x] Add MIDI support. @@ -51,16 +51,17 @@ To evaluate code, press `Ctrl+Enter` (no visible animation). This is true for ev ## UI -- [ ] Settings menu with all options. +- [x] Settings menu with all options. - [ ] Color themes (dark/light), other colors. - - [ ] Font size and font family. - - [ ] Vim mode. + - [x] Font size. + - [x] Vim mode. - [ ] Repair the current layout (aside + CodeMirror) - [ ] Optimizations for smaller screens and mobile devices. - [ ] Add a new "note" buffer for each universe (MarkDown) +- [ ] Find a way to visualize console logs somewhere ## Web Audio - [ ] Support Faut DSP integration. - [ ] Support Tone.js integration. -- [ ] WebAudio based engine. +- [x] WebAudio based engine. diff --git a/src/main.ts b/src/main.ts index 411d9f8..79c89db 100644 --- a/src/main.ts +++ b/src/main.ts @@ -373,10 +373,11 @@ export class Editor { this.closeBuffersModal(); // Focus on the editor this.view.focus(); - tryEvaluate(this, this.universes[this.selected_universe.toString()].init) } } }); + + tryEvaluate(this, this.universes[this.selected_universe.toString()].init) } get global_buffer() { @@ -403,49 +404,49 @@ export class Editor { } changeModeFromInterface(mode: "global" | "local" | "init") { - const interface_buttons: HTMLElement[] = [ - this.local_button, - this.global_button, - this.init_button, - ]; + + const interface_buttons: HTMLElement[] = [ this.local_button, this.global_button, this.init_button ]; let changeColor = (button: HTMLElement) => { interface_buttons.forEach((button) => { let svg = button.children[0] as HTMLElement; if (svg.classList.contains("text-orange-300")) { svg.classList.remove("text-orange-300"); - svg.classList.add("text-white"); + button.classList.remove("text-orange-300"); + console.log(svg.classList) + console.log(button.classList) } }); + button.children[0].classList.remove('text-white'); button.children[0].classList.add("text-orange-300"); + button.classList.add("text-orange-300"); }; - if (mode === this.editor_mode) return; switch (mode) { case "local": if (this.local_script_tabs.classList.contains("hidden")) { this.local_script_tabs.classList.remove("hidden"); } this.currentFile.candidate = this.view.state.doc.toString(); - changeColor(this.local_button); this.editor_mode = "local"; + changeColor(this.local_button); break; case "global": if (!this.local_script_tabs.classList.contains("hidden")) { this.local_script_tabs.classList.add("hidden"); } this.currentFile.candidate = this.view.state.doc.toString(); - changeColor(this.global_button); this.editor_mode = "global"; + changeColor(this.global_button); break; case "init": if (!this.local_script_tabs.classList.contains("hidden")) { this.local_script_tabs.classList.add("hidden"); } this.currentFile.candidate = this.view.state.doc.toString(); + this.editor_mode = "init"; changeColor(this.init_button); this.changeToLocalBuffer(0); - this.editor_mode = "init"; break; } this.updateEditorView(); @@ -545,6 +546,7 @@ export class Editor { this.view.dispatch({ changes: { from: 0, insert: this.currentFile.candidate }, }); + tryEvaluate(this, this.universes[this.selected_universe.toString()].init) } getCodeBlock(): string {