diff --git a/InitUiElements.ts b/InitUiElements.ts
index a5b738e9c..65a4485e0 100644
--- a/InitUiElements.ts
+++ b/InitUiElements.ts
@@ -352,6 +352,11 @@ export class InitUiElements {
State.state.backgroundLayer = State.state.backgroundLayerId
.map((selectedId: string) => {
+ if(selectedId === undefined){
+ return AvailableBaseLayers.osmCarto
+ }
+
+
const available = State.state.availableBackgroundLayers.data;
for (const layer of available) {
if (layer.id === selectedId) {
diff --git a/Logic/Actors/AvailableBaseLayers.ts b/Logic/Actors/AvailableBaseLayers.ts
index e9855a1cb..1a025d5a0 100644
--- a/Logic/Actors/AvailableBaseLayers.ts
+++ b/Logic/Actors/AvailableBaseLayers.ts
@@ -14,18 +14,19 @@ import {Utils} from "../../Utils";
export default class AvailableBaseLayers {
- public static osmCarto: BaseLayer =
+ public static osmCarto: BaseLayer =
{
id: "osm",
- name: "OpenStreetMap",
- layer: AvailableBaseLayers.CreateBackgroundLayer("osm", "OpenStreetMap",
- "https://tile.openstreetmap.org/{z}/{x}/{y}.png", "OpenStreetMap", "https://openStreetMap.org/copyright",
- 19,
- false, false),
+ name: "OpenStreetMap",
+ layer: () => AvailableBaseLayers.CreateBackgroundLayer("osm", "OpenStreetMap",
+ "https://tile.openstreetmap.org/{z}/{x}/{y}.png", "OpenStreetMap", "https://openStreetMap.org/copyright",
+ 19,
+ false, false),
feature: null,
max_zoom: 19,
min_zoom: 0
- }
+ }
+
public static layerOverview = AvailableBaseLayers.LoadRasterIndex().concat(AvailableBaseLayers.LoadProviderIndex());
@@ -123,7 +124,7 @@ export default class AvailableBaseLayers {
continue
}
- const leafletLayer = AvailableBaseLayers.CreateBackgroundLayer(
+ const leafletLayer: () => TileLayer = () => AvailableBaseLayers.CreateBackgroundLayer(
props.id,
props.name,
props.url,
@@ -150,10 +151,10 @@ export default class AvailableBaseLayers {
private static LoadProviderIndex(): BaseLayer[] {
// @ts-ignore
X; // Import X to make sure the namespace is not optimized away
- function l(id: string, name: string) {
+ function l(id: string, name: string) : BaseLayer{
try {
- const layer: any = L.tileLayer.provider(id, undefined);
- return {
+ const layer: any = () => L.tileLayer.provider(id, undefined);
+ const baseLayer : BaseLayer = {
feature: null,
id: id,
name: name,
@@ -161,6 +162,7 @@ export default class AvailableBaseLayers {
min_zoom: layer.minzoom,
max_zoom: layer.maxzoom
}
+ return baseLayer
} catch (e) {
console.error("Could not find provided layer", name, e);
return null;
diff --git a/Models/BaseLayer.ts b/Models/BaseLayer.ts
index 63c3abbc1..01eb8e9d7 100644
--- a/Models/BaseLayer.ts
+++ b/Models/BaseLayer.ts
@@ -3,7 +3,7 @@ import {TileLayer} from "leaflet";
export default interface BaseLayer {
id: string,
name: string,
- layer: TileLayer,
+ layer: () => TileLayer,
max_zoom: number,
min_zoom: number;
feature: any,
diff --git a/Svg.ts b/Svg.ts
index 3f0ff50fe..9a5c94b8f 100644
--- a/Svg.ts
+++ b/Svg.ts
@@ -104,11 +104,26 @@ export default class Svg {
public static direction_svg() { return new Img(Svg.direction, true);}
public static direction_ui() { return new FixedUiElement(Svg.direction_img);}
- public static direction_gradient = " "
+ public static direction_gradient = " "
public static direction_gradient_img = Img.AsImageElement(Svg.direction_gradient)
public static direction_gradient_svg() { return new Img(Svg.direction_gradient, true);}
public static direction_gradient_ui() { return new FixedUiElement(Svg.direction_gradient_img);}
+ public static direction_masked = " "
+ public static direction_masked_img = Img.AsImageElement(Svg.direction_masked)
+ public static direction_masked_svg() { return new Img(Svg.direction_masked, true);}
+ public static direction_masked_ui() { return new FixedUiElement(Svg.direction_masked_img);}
+
+ public static direction_outline = " "
+ public static direction_outline_img = Img.AsImageElement(Svg.direction_outline)
+ public static direction_outline_svg() { return new Img(Svg.direction_outline, true);}
+ public static direction_outline_ui() { return new FixedUiElement(Svg.direction_outline_img);}
+
+ public static direction_stroke = " "
+ public static direction_stroke_img = Img.AsImageElement(Svg.direction_stroke)
+ public static direction_stroke_svg() { return new Img(Svg.direction_stroke, true);}
+ public static direction_stroke_ui() { return new FixedUiElement(Svg.direction_stroke_img);}
+
public static down = " "
public static down_img = Img.AsImageElement(Svg.down)
public static down_svg() { return new Img(Svg.down, true);}
@@ -319,4 +334,4 @@ export default class Svg {
public static wikipedia_svg() { return new Img(Svg.wikipedia, true);}
public static wikipedia_ui() { return new FixedUiElement(Svg.wikipedia_img);}
-public static All = {"SocialImageForeground.svg": Svg.SocialImageForeground,"add.svg": Svg.add,"addSmall.svg": Svg.addSmall,"ampersand.svg": Svg.ampersand,"arrow-left-smooth.svg": Svg.arrow_left_smooth,"arrow-right-smooth.svg": Svg.arrow_right_smooth,"back.svg": Svg.back,"bug.svg": Svg.bug,"camera-plus.svg": Svg.camera_plus,"checkmark.svg": Svg.checkmark,"circle.svg": Svg.circle,"clock.svg": Svg.clock,"close.svg": Svg.close,"compass.svg": Svg.compass,"cross_bottom_right.svg": Svg.cross_bottom_right,"crosshair-blue-center.svg": Svg.crosshair_blue_center,"crosshair-blue.svg": Svg.crosshair_blue,"crosshair.svg": Svg.crosshair,"delete_icon.svg": Svg.delete_icon,"direction.svg": Svg.direction,"direction_gradient.svg": Svg.direction_gradient,"down.svg": Svg.down,"envelope.svg": Svg.envelope,"floppy.svg": Svg.floppy,"gear.svg": Svg.gear,"help.svg": Svg.help,"home.svg": Svg.home,"home_white_bg.svg": Svg.home_white_bg,"josm_logo.svg": Svg.josm_logo,"layers.svg": Svg.layers,"layersAdd.svg": Svg.layersAdd,"logo.svg": Svg.logo,"logout.svg": Svg.logout,"mapcomplete_logo.svg": Svg.mapcomplete_logo,"mapillary.svg": Svg.mapillary,"mapillary_black.svg": Svg.mapillary_black,"min.svg": Svg.min,"no_checkmark.svg": Svg.no_checkmark,"or.svg": Svg.or,"osm-copyright.svg": Svg.osm_copyright,"osm-logo-us.svg": Svg.osm_logo_us,"osm-logo.svg": Svg.osm_logo,"pencil.svg": Svg.pencil,"phone.svg": Svg.phone,"pin.svg": Svg.pin,"plus.svg": Svg.plus,"pop-out.svg": Svg.pop_out,"reload.svg": Svg.reload,"ring.svg": Svg.ring,"search.svg": Svg.search,"send_email.svg": Svg.send_email,"share.svg": Svg.share,"square.svg": Svg.square,"star.svg": Svg.star,"star_half.svg": Svg.star_half,"star_outline.svg": Svg.star_outline,"star_outline_half.svg": Svg.star_outline_half,"statistics.svg": Svg.statistics,"translate.svg": Svg.translate,"up.svg": Svg.up,"wikidata.svg": Svg.wikidata,"wikimedia-commons-white.svg": Svg.wikimedia_commons_white,"wikipedia.svg": Svg.wikipedia};}
+public static All = {"SocialImageForeground.svg": Svg.SocialImageForeground,"add.svg": Svg.add,"addSmall.svg": Svg.addSmall,"ampersand.svg": Svg.ampersand,"arrow-left-smooth.svg": Svg.arrow_left_smooth,"arrow-right-smooth.svg": Svg.arrow_right_smooth,"back.svg": Svg.back,"bug.svg": Svg.bug,"camera-plus.svg": Svg.camera_plus,"checkmark.svg": Svg.checkmark,"circle.svg": Svg.circle,"clock.svg": Svg.clock,"close.svg": Svg.close,"compass.svg": Svg.compass,"cross_bottom_right.svg": Svg.cross_bottom_right,"crosshair-blue-center.svg": Svg.crosshair_blue_center,"crosshair-blue.svg": Svg.crosshair_blue,"crosshair.svg": Svg.crosshair,"delete_icon.svg": Svg.delete_icon,"direction.svg": Svg.direction,"direction_gradient.svg": Svg.direction_gradient,"direction_masked.svg": Svg.direction_masked,"direction_outline.svg": Svg.direction_outline,"direction_stroke.svg": Svg.direction_stroke,"down.svg": Svg.down,"envelope.svg": Svg.envelope,"floppy.svg": Svg.floppy,"gear.svg": Svg.gear,"help.svg": Svg.help,"home.svg": Svg.home,"home_white_bg.svg": Svg.home_white_bg,"josm_logo.svg": Svg.josm_logo,"layers.svg": Svg.layers,"layersAdd.svg": Svg.layersAdd,"logo.svg": Svg.logo,"logout.svg": Svg.logout,"mapcomplete_logo.svg": Svg.mapcomplete_logo,"mapillary.svg": Svg.mapillary,"mapillary_black.svg": Svg.mapillary_black,"min.svg": Svg.min,"no_checkmark.svg": Svg.no_checkmark,"or.svg": Svg.or,"osm-copyright.svg": Svg.osm_copyright,"osm-logo-us.svg": Svg.osm_logo_us,"osm-logo.svg": Svg.osm_logo,"pencil.svg": Svg.pencil,"phone.svg": Svg.phone,"pin.svg": Svg.pin,"plus.svg": Svg.plus,"pop-out.svg": Svg.pop_out,"reload.svg": Svg.reload,"ring.svg": Svg.ring,"search.svg": Svg.search,"send_email.svg": Svg.send_email,"share.svg": Svg.share,"square.svg": Svg.square,"star.svg": Svg.star,"star_half.svg": Svg.star_half,"star_outline.svg": Svg.star_outline,"star_outline_half.svg": Svg.star_outline_half,"statistics.svg": Svg.statistics,"translate.svg": Svg.translate,"up.svg": Svg.up,"wikidata.svg": Svg.wikidata,"wikimedia-commons-white.svg": Svg.wikimedia_commons_white,"wikipedia.svg": Svg.wikipedia};}
diff --git a/UI/Base/Minimap.ts b/UI/Base/Minimap.ts
new file mode 100644
index 000000000..de7de1718
--- /dev/null
+++ b/UI/Base/Minimap.ts
@@ -0,0 +1,144 @@
+import BaseUIElement from "../BaseUIElement";
+import * as L from "leaflet";
+import {UIEventSource} from "../../Logic/UIEventSource";
+import Loc from "../../Models/Loc";
+import BaseLayer from "../../Models/BaseLayer";
+import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers";
+import {Map} from "leaflet";
+
+export default class Minimap extends BaseUIElement {
+
+ private static _nextId = 0;
+ public readonly leafletMap: UIEventSource