Bypass the rendering pipeline for highlighting to reduce (eliminate) latency

Fixes #15
This commit is contained in:
Ian Gulliver
2019-07-14 02:26:00 +00:00
parent a4630ba92a
commit f3823812c7
18 changed files with 96 additions and 123 deletions

View File

@@ -9,14 +9,9 @@ class EditorNode extends EditorInputBase {
serialize() {
return super.serialize({
type: 'node',
highlight: this.elem_.classList.contains('highlight'),
});
}
setHighlight(highlight) {
this.elem_.classList.toggle('highlight', highlight);
}
isSoft() {
// Nested nodes are presumed to be references to other nodes if they exist
for (let iter = this.elem_.parentElement; iter; iter = iter.parentElement) {
@@ -27,20 +22,6 @@ class EditorNode extends EditorInputBase {
return false;
}
onKeyDown(e) {
super.onKeyDown(e);
switch (e.key) {
case ' ':
this.elem_.classList.toggle('highlight');
this.elem_.setAttribute('data-arch-snapshot', '');
this.onInput();
e.stopPropagation();
e.preventDefault();
break;
}
}
static unserialize(ser) {
let node = new EditorNode(ser.id);
node.setLabel(ser.label);