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