Add webapp option to default to flat-view

This commit is contained in:
Lukas Rieger (Blue) 2023-07-04 14:42:12 +02:00
parent 16c4b281ef
commit 1f7f51c1e1
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
4 changed files with 17 additions and 1 deletions

View File

@ -143,7 +143,7 @@ public void updateFiles() throws IOException {
}
}
@SuppressWarnings("all")
@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal", "unused", "MismatchedQueryAndUpdateOfCollection"})
private static class Settings {
private String version = BlueMap.VERSION;
@ -151,6 +151,7 @@ private static class Settings {
private boolean useCookies = true;
private boolean enableFreeFlight = true;
private boolean defaultToFlatView = false;
private String startLocation = null;
@ -174,6 +175,7 @@ private static class Settings {
public void setFrom(WebappConfig config) {
this.useCookies = config.isUseCookies();
this.enableFreeFlight = config.isEnableFreeFlight();
this.defaultToFlatView = config.isDefaultToFlatView();
this.startLocation = config.getStartLocation().orElse(null);
this.resolutionDefault = config.getResolutionDefault();

View File

@ -45,6 +45,7 @@ public class WebappConfig {
private boolean useCookies = true;
private boolean enableFreeFlight = true;
private boolean defaultToFlatView = false;
private String startLocation = null;
@ -83,6 +84,10 @@ public boolean isEnableFreeFlight() {
return enableFreeFlight;
}
public boolean isDefaultToFlatView() {
return defaultToFlatView;
}
public Optional<String> getStartLocation() {
return Optional.ofNullable(startLocation);
}

View File

@ -26,6 +26,10 @@ use-cookies: true
# Default is true
enable-free-flight: true
# If the webapp will default to flat-view instead of perspective-view.
# Default is false
default-to-flat-view: false
# The default map and camera-location where a user will start after opening the webapp.
# This is in form of the url-anchor: Open your map in a browser and look at the url, everything after the '#' is the value for this setting.
# Default is "no anchor" -> The camera will start with the topmost map and at that map's starting point.

View File

@ -60,6 +60,7 @@ export class BlueMapApp {
* version: string,
* useCookies: boolean,
* enableFreeFlight: boolean,
* defaultToFlatView: boolean,
* resolutionDefault: number,
* minZoomDistance: number,
* maxZoomDistance: number,
@ -280,6 +281,10 @@ export class BlueMapApp {
controls.controls = this.mapControls;
this.appState.controls.state = "perspective";
if (this.settings.defaultToFlatView) {
this.setFlatView();
}
this.updatePageAddress();
}