Merge pull request #92 from matthewd673/master

Only register export click event once (#89)
This commit is contained in:
Nicola 2022-08-25 19:58:56 +02:00 committed by GitHub
commit 8a42ddd571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ const FileManager = (() => {
Events.on('change', browseHolder, loadFile); Events.on('change', browseHolder, loadFile);
Events.on('change', browsePaletteHolder, loadPalette); Events.on('change', browsePaletteHolder, loadPalette);
Events.on('click', 'export-confirm', exportProject);
function openSaveProjectWindow() { function openSaveProjectWindow() {
//create name //create name
@ -27,16 +28,16 @@ const FileManager = (() => {
function openPixelExportWindow() { function openPixelExportWindow() {
let selectedPalette = Util.getText('palette-button'); let selectedPalette = Util.getText('palette-button');
if (selectedPalette != 'Choose a palette...'){ if (selectedPalette != 'Choose a palette...'){
var paletteAbbreviation = palettes[selectedPalette].name; var paletteAbbreviation = palettes[selectedPalette].name;
var fileName = 'pixel-'+paletteAbbreviation+'-'+canvasSize[0]+'x'+canvasSize[1]+'.png'; var fileName = 'pixel-'+paletteAbbreviation+'-'+currFile.canvasSize[0]+'x'+currFile.canvasSize[1]+'.png';
} else { } else {
var fileName = 'pixel-'+currFile.canvasSize[0]+'x'+currFile.canvasSize[1]+'.png'; var fileName = 'pixel-'+currFile.canvasSize[0]+'x'+currFile.canvasSize[1]+'.png';
selectedPalette = 'none'; selectedPalette = 'none';
} }
Util.setValue('export-file-name', fileName); Util.setValue('export-file-name', fileName);
Events.on("click", "export-confirm", exportProject);
Dialogue.showDialogue('export', false); Dialogue.showDialogue('export', false);
} }