Node highlighting

This commit is contained in:
Ian Gulliver
2019-07-10 23:19:39 +00:00
parent 4857bb97cb
commit d52c8206a6
5 changed files with 31 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ class Grid {
break;
case 'node':
this.drawNode(step.label, step.pos);
this.drawNode(step.label, step.pos, step.highlight);
break;
}
}
@@ -122,11 +122,12 @@ class Grid {
this.toSize_.push(elem);
}
drawNode(label, pos) {
drawNode(label, pos, highlight) {
let node = document.createElement('div');
node.classList.add('gridNode');
this.container_.appendChild(node);
node.innerText = label;
node.classList.toggle('highlight', highlight);
node.style.gridColumn = pos[0] + 1;
node.style.gridRow = pos[1] + 1;
this.toSize_.push(node);