Browse Source

Tweaks

dev
Bryan Miller 5 years ago
parent
commit
1c0213ac24
1 changed files with 20 additions and 3 deletions
  1. +20
    -3
      app/js/ctrls/CTRLBanksStore.js

+ 20
- 3
app/js/ctrls/CTRLBanksStore.js View File

@@ -78,8 +78,10 @@ class CTRLBanksStore{
constructor(){
var HANDLE_ChangeSurface = function(surf){
if (!(surf instanceof NESBank)){
// TODO: Unselect any current bank element.
CurrentBankIndex = "";
if (CurrentBank !== ""){
Banks[CurrentBank].el.classList.remove(BLI_SELECTED);
CurrentBank = "";
}
} else {
if (Banks.length <= 0 || (CurrentBank !== "" && Banks[CurrentBank].bank !== surf)){
console.log("WARNING: Bank object being set outside of Bank Store.");
@@ -87,6 +89,19 @@ class CTRLBanksStore{
}
}
GlobalEvents.listen("change_surface", HANDLE_ChangeSurface);


GlobalEvents.listen("bankstore-add", (function(e){
if (e.hasOwnProperty("bankname")){
this.createBank(e.bankname);
this.activateBank(e.bankname);
}
}).bind(this));

GlobalEvents.listen("bankstore-remove", (function(e){
if (CurrentBank !== "")
this.removeBank(CurrentBank);
}).bind(this));
}

get length(){
@@ -152,7 +167,9 @@ class CTRLBanksStore{
Banks[name].el.parentNode.removeChild(Banks[name].el);
delete Banks[name];
if (CurrentBank !== ""){
// TODO: Activate new Bank.
Banks[CurrentBank].el.click();
} else {
GlobalEvents.emit("change_surface", null);
}
}
return this;

Loading…
Cancel
Save