MCPcopy Create free account
hub / github.com/NikLever/ThreeJS-PathEditor / constructor

Method constructor

menu.js:2–24  ·  view source on GitHub ↗
( app, links )

Source from the content-addressed store, hash-verified

1export class Menu{
2 constructor( app, links ){
3 this.menu = document.querySelector(".context-menu");
4 this.menuState = 0;
5 this.contextMenuActive = "block";
6 this.app = app;
7
8 this.addLinks( links );
9
10 document.addEventListener("contextmenu", (e) => {
11 e.preventDefault();
12 this.show(e);
13 });
14
15 // Event Listener for Close Context Menu when outside of menu clicked
16 document.addEventListener("click", (e) => {
17 this.hide();
18 });
19
20 // Close Context Menu on Esc key press
21 window.onkeyup = (e) => {
22 if (e.keyCode === 27) this.hide();
23 }
24 }
25
26 addLinks( links = [] ){
27 let html = "";

Callers

nothing calls this directly

Calls 3

addLinksMethod · 0.95
showMethod · 0.95
hideMethod · 0.95

Tested by

no test coverage detected