mirror of
https://forge.murkfall.net/bluesaxman/librePECS.git
synced 2026-03-13 10:14:20 -06:00
Added function to show the library dialog when a blank pec is clicked.
This commit is contained in:
16
main.js
16
main.js
@@ -2,13 +2,22 @@
|
|||||||
// Why am I doing this?
|
// Why am I doing this?
|
||||||
class auxillery_dialog {
|
class auxillery_dialog {
|
||||||
constructor (title) {
|
constructor (title) {
|
||||||
|
var me = this;
|
||||||
this.root = document.createElement("div");
|
this.root = document.createElement("div");
|
||||||
|
this.root.classList.add("dialog");
|
||||||
this.title = "string" == typeof title ? title : "";
|
this.title = "string" == typeof title ? title : "";
|
||||||
var title_bar = document.createElement("div");
|
var title_bar = document.createElement("div");
|
||||||
title_bar.innerText = this.title;
|
title_bar.innerText = this.title;
|
||||||
this.root.appendChild(title_bar);
|
this.root.appendChild(title_bar);
|
||||||
this.body = document.createElement("div");
|
this.body = document.createElement("div");
|
||||||
this.root.appendChild(this.body);
|
this.root.appendChild(me.body);
|
||||||
|
var close = document.createElement("span");
|
||||||
|
close.innerText = "<";
|
||||||
|
close.classList.add("close");
|
||||||
|
title_bar.appendChild(close);
|
||||||
|
close.addEventListener("click", ()=>{
|
||||||
|
me.root.classList.remove("focused");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,5 +45,10 @@ for (var x = 0; x < 16; x++) {
|
|||||||
thisPec.classList.add("pecSlot","empty");
|
thisPec.classList.add("pecSlot","empty");
|
||||||
thisPec.innerHTML = "<p>+</p>";
|
thisPec.innerHTML = "<p>+</p>";
|
||||||
app.gui.view.appendChild(thisPec);
|
app.gui.view.appendChild(thisPec);
|
||||||
|
thisPec.addEventListener("click", (p,x)=>{
|
||||||
|
app.currentPec = p;
|
||||||
|
app.currentPecIndex = x;
|
||||||
|
app.gui.library.root.classList.add("focused");
|
||||||
|
}, thisPec, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user