Add multiple font options

This commit is contained in:
Evan Barger
2020-04-01 19:37:01 -04:00
parent b81a456a95
commit cb44d8a83b
15 changed files with 151 additions and 132 deletions

View File

@@ -13,7 +13,8 @@ let app = new Vue({
processor: new Processor([]),
filename: 'GBNP',
mapData: '',
romData: ''
romData: '',
fontIndex: 0
},
created: function() {
this.processor.menu = this.menu;
@@ -24,6 +25,11 @@ let app = new Vue({
},
romOverflow: function() { return this.processor.romOverflow(); }
},
watch: {
fontIndex: function() {
for (let i = 0; i < this.roms.length; i++) { this.roms[i].updateBitmap(this.fontIndex); }
}
},
methods: {
addMenu: function(e) {
let fileReader = new FileReader()
@@ -34,7 +40,7 @@ let app = new Vue({
},
addROM: function(e) {
let fileReader = new FileReader()
fileReader.onload = () => this.roms.push(new ROM(fileReader.result));
fileReader.onload = () => this.roms.push(new ROM(fileReader.result, this.fontIndex));
fileReader.readAsArrayBuffer(e.target.files[0]);
this.processor.roms = this.roms;
@@ -67,8 +73,8 @@ let app = new Vue({
},
updateMenuText: function(rom, val) {
if (rom.bitmapTimeoutHandle) { clearTimeout(rom.bitmapTimeoutHandle); }
rom.bitmapTimeoutHandle = setTimeout(function() {
rom.updateMenuText(val);
rom.bitmapTimeoutHandle = setTimeout(() => {
rom.updateMenuText(val, this.fontIndex);
}, 500);
},
stopPropagation: function(e) { e.stopImmediatePropagation(); },