Skip to content

Commit

Permalink
do not show the menu in case of clicking the icon
Browse files Browse the repository at this point in the history
  • Loading branch information
olibu committed Apr 19, 2024
1 parent 60383f9 commit a6cf850
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions context.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ export function bindContextMenu(node) {
const type = node.asn1.typeName();
const valueEnabled = type != 'SET' && type != 'SEQUENCE';
node.onclick = function (event) {
contextMenu.style.left = event.pageX + 'px';
contextMenu.style.top = event.pageY + 'px';
contextMenu.style.visibility = 'visible';
contextMenu.node = this;
btnHideTree.innerText = (node.className == 'node') ? 'Hide subtree' : 'Show subtree';
btnHideTree.style.display = node.className.startsWith('node') ? 'block' : 'none';
btnCopyValue.style.display = valueEnabled ? 'block' : 'none';
event.stopPropagation();
// do not show the menu in case of clicking the icon
if (event.srcElement.nodeName !== "SUMMARY") {
contextMenu.style.left = event.pageX + 'px';
contextMenu.style.top = event.pageY + 'px';
contextMenu.style.visibility = 'visible';
contextMenu.node = this;
btnHideTree.innerText = (node.className == 'node') ? 'Hide subtree' : 'Show subtree';
btnHideTree.style.display = node.className.startsWith('node') ? 'block' : 'none';
btnCopyValue.style.display = valueEnabled ? 'block' : 'none';
event.preventDefault();
event.stopPropagation();
}
};
}

Expand Down

0 comments on commit a6cf850

Please sign in to comment.