fix contextmenu
This commit is contained in:
parent
673359ef65
commit
f3a24546b0
1 changed files with 6 additions and 3 deletions
|
@ -53,11 +53,11 @@ class Contextmenu<x, y>{
|
||||||
|
|
||||||
let visibleButtons = 0;
|
let visibleButtons = 0;
|
||||||
for(const thing of this.buttons){
|
for(const thing of this.buttons){
|
||||||
if(!thing[3].bind(addinfo).call(addinfo, other))continue;
|
if(!thing[3].call(addinfo, other))continue;
|
||||||
visibleButtons++;
|
visibleButtons++;
|
||||||
|
|
||||||
const intext = document.createElement("button");
|
const intext = document.createElement("button");
|
||||||
intext.disabled = !thing[4].bind(addinfo).call(addinfo, other);
|
intext.disabled = !thing[4].call(addinfo, other);
|
||||||
intext.classList.add("contextbutton");
|
intext.classList.add("contextbutton");
|
||||||
if(thing[0] instanceof Function){
|
if(thing[0] instanceof Function){
|
||||||
intext.textContent = thing[0]();
|
intext.textContent = thing[0]();
|
||||||
|
@ -66,7 +66,10 @@ class Contextmenu<x, y>{
|
||||||
}
|
}
|
||||||
console.log(thing);
|
console.log(thing);
|
||||||
if(thing[5] === "button" || thing[5] === "submenu"){
|
if(thing[5] === "button" || thing[5] === "submenu"){
|
||||||
intext.onclick = thing[1].bind(addinfo, other);
|
intext.onclick = (e)=>{
|
||||||
|
div.remove();
|
||||||
|
thing[1].call(addinfo, other,e)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
div.appendChild(intext);
|
div.appendChild(intext);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue