Browse Source

Fixed bugs and typos in NESNameTable and CTRLNameTablesStore.

dev
Bryan Miller 5 years ago
parent
commit
a66a7cc2ea
2 changed files with 10 additions and 10 deletions
  1. +9
    -9
      app/js/ctrls/CTRLNameTablesStore.js
  2. +1
    -1
      app/js/models/NESNameTable.js

+ 9
- 9
app/js/ctrls/CTRLNameTablesStore.js View File

}); });




function HANDLE_NTClick(e){
function HANDLE_NametableClick(e){
var name = this.getAttribute("ntname"); var name = this.getAttribute("ntname");
if (name !== CurrentNT){ if (name !== CurrentNT){
if (CurrentNT !== "") if (CurrentNT !== "")
var data = []; var data = [];
Object.keys(Nametables).forEach((key) => { Object.keys(Nametables).forEach((key) => {
if (Nametables.hasOwnProperty(key)){ if (Nametables.hasOwnProperty(key)){
jdata = {
var jdata = {
name: key, name: key,
data: Nametables[key].nametable.base64 data: Nametables[key].nametable.base64
}; };
} }


initialize(){ initialize(){
if (this.length <= 0){
this.createNametable("Nametable");
}
//if (this.length <= 0){
// this.createNametable("Nametable");
//}
return this; return this;
} }




createBank(name, bbase64){
createNametable(name, bbase64){
if (!(name in Nametables)){ if (!(name in Nametables)){
var nametable = new NESNameTable(); var nametable = new NESNameTable();
if (typeof(bbase64) === "string"){ if (typeof(bbase64) === "string"){
} }




removeBank(name){
removeNametable(name){
if (name in Nametables){ if (name in Nametables){
if (name === CurrentNT){ if (name === CurrentNT){
var keys = Object.keys(Nametables); var keys = Object.keys(Nametables);
return this; return this;
} }


renameBank(name, newname){
renameNametable(name, newname){
if ((name in Nametables) && !(newname in Nametables)){ if ((name in Nametables) && !(newname in Nametables)){
Nametables[newname] = Nametables[name]; Nametables[newname] = Nametables[name];
Nametables[newname].elname.value = newname; Nametables[newname].elname.value = newname;
return this; return this;
} }


activateBank(name){
activateNametable(name){
if (CurrentNT !== name && (name in Nametables)){ if (CurrentNT !== name && (name in Nametables)){
Nametables[name].el.click(); Nametables[name].el.click();
} }

+ 1
- 1
app/js/models/NESNameTable.js View File



get bank(){return this.__bank;} get bank(){return this.__bank;}
set bank(b){ set bank(b){
if (b !== null and !(b instanceof NESBank))
if (b !== null && !(b instanceof NESBank))
throw new TypeError("Expected a NESBank object."); throw new TypeError("Expected a NESBank object.");
this.__bank = b; this.__bank = b;
this.emit("data_changed"); this.emit("data_changed");

Loading…
Cancel
Save