Skip to content

Commit

Permalink
Provide visual feedback when there is no circuit to see
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Feb 7, 2022
1 parent 78f55b6 commit 50454e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/document.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ export class Document {
return this.#processMarker(message.markers);
case 'clearmarker':
return this.#clearMarker();
case 'do-synth':
return this.doSynth();
}
}
}
9 changes: 8 additions & 1 deletion view/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,14 @@ class DigitalJS {
}
const old_states = await this.#collectStates();
this.#destroyCircuit();
if (circuit_empty(data))
if (circuit_empty(data)) {
const paper_div = $('#paper');
paper_div.html('<h1 style="text-align:center">No active circuit.</h1>');
const btn = $('<p style="text-align:center"><vscode-button><i slot="start" class="codicon codicon-run"></i> Synthesize</vscode-button></p>');
btn.click(() => vscode.postMessage({ command: "do-synth" }));
paper_div.append(btn);
return;
}
const circuit_opts = {
layoutEngine: 'elkjs',
engine: Engine,
Expand Down Expand Up @@ -842,6 +848,7 @@ class DigitalJS {
this.#lua.shutdown();
this.#updateRunStates();
$('#monitorbox vscode-button').prop('disabled', true).off();
$('#paper').empty();
}
#pauseSim() {
this.circuit.stop();
Expand Down

0 comments on commit 50454e8

Please sign in to comment.