Widgets implemented.

This commit is contained in:
Mal
2020-02-04 21:42:14 +01:00
parent d893483da9
commit d46b195269
11 changed files with 197 additions and 45 deletions

View File

@@ -29,10 +29,16 @@ export default class Tilorswift
static saveTerrainToFile(terrain)
{
let filename = prompt('Dateiname', 'terrain.json');
if (filename === null) {
return;
}
let json = Tilorswift.getTerrainAsJson(terrain);
let download = document.createElement('a');
download.setAttribute('download', 'terrain.json');
download.setAttribute('download', filename);
download.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(json));
download.click();
download.remove();