mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 02:01:22 +01:00
refactor(es modules): continue migration
This commit is contained in:
parent
922c6e2431
commit
364f33975f
50 changed files with 180 additions and 85 deletions
|
|
@ -1,4 +1,4 @@
|
|||
"use strict";
|
||||
import {tip} from "/src/scripts/tooltips";
|
||||
|
||||
/*
|
||||
Cloud provider implementations (Dropbox only as now)
|
||||
|
|
@ -13,7 +13,6 @@ async list(): list available filenames at provider
|
|||
async getLink(filePath): get shareable link for file
|
||||
restore(): restore access tokens from storage if possible
|
||||
*/
|
||||
|
||||
window.Cloud = (function () {
|
||||
// helpers to use in providers for token handling
|
||||
const lSKey = x => `auth-${x}`;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import {getGridPolygon} from "/src/utils/graphUtils";
|
||||
import {unique} from "/src/utils/arrayUtils";
|
||||
import {tip} from "/src/scripts/tooltips";
|
||||
|
||||
// download map as SVG
|
||||
async function saveSVG() {
|
||||
|
|
@ -10,12 +11,8 @@ async function saveSVG() {
|
|||
link.href = url;
|
||||
link.click();
|
||||
|
||||
tip(
|
||||
`${link.download} is saved. Open "Downloads" screen (crtl + J) to check. You can set image scale in options`,
|
||||
true,
|
||||
"success",
|
||||
5000
|
||||
);
|
||||
const tooltip = `${link.download} is saved. Open "Downloads" screen (CTRL + J) to check. You can image scale in options`;
|
||||
tip(tooltip, true, "success", 5000);
|
||||
TIME && console.timeEnd("saveSVG");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {restoreDefaultEvents} from "/src/scripts/events";
|
||||
import {calculateVoronoi, findCell} from "/src/utils/graphUtils";
|
||||
import {last} from "/src/utils/arrayUtils";
|
||||
import {tip} from "/src/scripts/tooltips";
|
||||
|
||||
function quickLoad() {
|
||||
ldb.get("lastMap", blob => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
"use strict";
|
||||
import {tip} from "/src/scripts/tooltips";
|
||||
|
||||
// functions to save project as .map file
|
||||
|
||||
// prepare map data for saving
|
||||
|
|
@ -122,7 +123,8 @@ function getMapData() {
|
|||
|
||||
// Download .map file
|
||||
function dowloadMap() {
|
||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
if (customization)
|
||||
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
closeDialogs("#alert");
|
||||
|
||||
const mapData = getMapData();
|
||||
|
|
@ -137,7 +139,8 @@ function dowloadMap() {
|
|||
}
|
||||
|
||||
async function saveToDropbox() {
|
||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
if (customization)
|
||||
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
closeDialogs("#alert");
|
||||
const mapData = getMapData();
|
||||
const filename = getFileName() + ".map";
|
||||
|
|
@ -151,7 +154,8 @@ async function saveToDropbox() {
|
|||
}
|
||||
|
||||
function quickSave() {
|
||||
if (customization) return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
if (customization)
|
||||
return tip("Map cannot be saved when edit mode is active, please exit the mode and retry", false, "error");
|
||||
|
||||
const mapData = getMapData();
|
||||
const blob = new Blob([mapData], {type: "text/plain"});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue