Reaction support

This commit is contained in:
MathMan05 2024-08-05 21:47:40 -05:00
parent 8b3fe48a74
commit 24bdde1968
12 changed files with 458 additions and 51 deletions

View file

@ -20,7 +20,11 @@ class Contextmenu {
this.buttons = [];
}
addbutton(text, onclick, img = null, shown = _ => true, enabled = _ => true) {
this.buttons.push([text, onclick, img, shown, enabled]);
this.buttons.push([text, onclick, img, shown, enabled, "button"]);
return {};
}
addsubmenu(text, onclick, img = null, shown = _ => true, enabled = _ => true) {
this.buttons.push([text, onclick, img, shown, enabled, "submenu"]);
return {};
}
makemenu(x, y, addinfo, obj) {
@ -38,7 +42,12 @@ class Contextmenu {
intext.textContent = thing[0];
textb.appendChild(intext);
console.log(thing);
intext.onclick = thing[1].bind(addinfo, obj);
if (thing[5] === "button") {
intext.onclick = thing[1].bind(addinfo, obj);
}
else if (thing[5] === "submenu") {
intext.onclick = thing[1].bind(addinfo);
}
div.appendChild(textb);
}
if (Contextmenu.currentmenu != "") {