Skip to content

Commit

Permalink
Align line numbers in general memory
Browse files Browse the repository at this point in the history
  • Loading branch information
equationcrunchor committed Jul 5, 2019
1 parent bdaf97c commit f6d5a8c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
10 changes: 10 additions & 0 deletions static/css/simulations.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
button {
font-family: Acre-Regular;
}

.general_memory {
float: left;
text-align: left;
}

.tooltip-inner {
white-space: pre-wrap;
}
Expand Down Expand Up @@ -51,6 +60,7 @@ body {

.line_no_text {
vertical-align: center;
font-family: Courier, monospace;
}

#code {
Expand Down
21 changes: 12 additions & 9 deletions static/js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ export class Renderer {
create_memory_display() {
const general_memory_display = document.getElementById("general_memory_div");
for (let i = 0; i < this.computer.size; i++) {
const para = document.createElement("p");
const register = document.createTextNode(i.toString()+": ");
para.appendChild(register);
const span = document.createElement("span");
span.setAttribute("class", "general_memory number");
span.setAttribute("id", "general_memory" + i.toString());
span.setAttribute("data-toggle", "tooltip");
para.appendChild(span);
general_memory_display.appendChild(para);
let element = $(`
<div class="row general_memory_row">
<div class="col-2">
<p class="text-right float-right line_no_text">${i.toString()}: </p>
</div>
<div class="col-10">
<span class="general_memory number" id="general_memory_${i.toString()}"
data-toggle="tooltip"></span>
</div>
</div>
`)[0];
general_memory_display.appendChild(element);
}
}

Expand Down

0 comments on commit f6d5a8c

Please sign in to comment.