Skip to content

Commit

Permalink
Menu added to tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
olibu committed Mar 31, 2024
1 parent 620bc08 commit 80e7a8b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class ASN1DOM extends ASN1 {
head.appendChild(DOM.space());
}
}
head.setAttribute('pos', this.posStart());
head.setAttribute('end', this.posEnd());
head.appendChild(DOM.text(typeName));
let content;
try {
Expand Down Expand Up @@ -151,8 +153,15 @@ class ASN1DOM extends ASN1 {
sub.appendChild(this.sub[i].toDOM(spaces));
}
node.appendChild(sub);
head.onclick = function () {
node.className = (node.className == 'node collapsed') ? 'node' : 'node collapsed';
head.onclick = function (event) {
console.log(this.asn1)
let contextMenu = document.getElementById('contextmenu');
contextMenu.style.left = event.pageX + "px";
contextMenu.style.top = event.pageY + "px";
contextMenu.style.visibility = 'visible';
document.getElementById('contextmenu').node = this;
event.stopPropagation();
//node.className = (node.className == 'node collapsed') ? 'node' : 'node collapsed';
};
return node;
}
Expand Down

0 comments on commit 80e7a8b

Please sign in to comment.