mirror of
https://forge.murkfall.net/bluesaxman/librePECS.git
synced 2026-03-13 02:04:20 -06:00
Added additional init stuff, fixed event listener refs
This commit is contained in:
26
main.js
26
main.js
@@ -139,10 +139,26 @@ for (var x = 0; x < 16; x++) {
|
||||
thisPec.id = name;
|
||||
clearPec(x);
|
||||
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);
|
||||
}
|
||||
// Create our initial board
|
||||
app.boards = [];
|
||||
app.boards.push(new pecBoard());
|
||||
app.currentBoard = app.boards[0];
|
||||
repopGrid(app.currentBoard);
|
||||
|
||||
// Populate Library
|
||||
app.library = [];
|
||||
app.library.push(new pec("No",""));
|
||||
app.library.push(new pec("Up",""));
|
||||
app.library.push(new pec("More",""));
|
||||
app.library.push(new pec("Drink",""));
|
||||
app.library.push(new pec("Food",""));
|
||||
// add more here
|
||||
app.library.forEach((p,i)=>{
|
||||
var newPec = document.createElement("span");
|
||||
newPec.classList.add("pecSlot");
|
||||
newPec.innerText = p.word;
|
||||
newPec.id = "lPec"+i;
|
||||
newPec.addEventListener("click", useThisPec);
|
||||
app.gui.library.body.appendChild(newPec);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user