mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
feat: add default map setting feature
Add ability to set a specific map as the default that opens on load: - Add 'Open default map' option to onload behavior dropdown - Implement saveAsDefaultMap() to store map as default in IndexedDB - Implement clearDefaultMap() to remove default map setting - Modify checkLoadParameters() to load default map when configured - Add UI buttons in Save dialog for setting/clearing default map - Update version to 1.108.12 and hash in index.html Users can now: 1. Open any map they want as default 2. Go to Options > Onload behavior > Select "Open default map" 3. Save > Click "Set as default" button 4. The map will now open automatically every time This sets the foundation for the planned time-based worldbuilding and lore database features by ensuring users always start with their primary world map.
This commit is contained in:
parent
6afa016920
commit
acc2d112f3
4 changed files with 55 additions and 3 deletions
16
main.js
16
main.js
|
|
@ -291,6 +291,22 @@ async function checkLoadParameters() {
|
|||
return;
|
||||
}
|
||||
|
||||
// check if there is a default map saved to indexedDB
|
||||
if (byId("onloadBehavior").value === "default") {
|
||||
try {
|
||||
const blob = await ldb.get("defaultMap");
|
||||
if (blob) {
|
||||
WARN && console.warn("Loading default map");
|
||||
uploadMap(blob);
|
||||
return;
|
||||
} else {
|
||||
WARN && console.warn("No default map set, generating random map");
|
||||
}
|
||||
} catch (error) {
|
||||
ERROR && console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
// check if there is a map saved to indexedDB
|
||||
if (byId("onloadBehavior").value === "lastSaved") {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue