diff --git a/Customizations/JSON/TagRenderingParser.ts b/Customizations/JSON/TagRenderingParser.ts new file mode 100644 index 0000000..7b3107f --- /dev/null +++ b/Customizations/JSON/TagRenderingParser.ts @@ -0,0 +1,24 @@ +import {TagRenderingOptions} from "../TagRenderingOptions"; +import {LayerDefinition} from "../LayerDefinition"; + + +export class CustomizationFromJSON { + + public exampleLayer = { + id: "bookcases", + + } + + /* + public static LayerFromJson(spec: any) : LayerDefinition{ + return new LayerDefinition(spec.id,{ + + }) + } + */ + public static TagRenderingOptionsFromJson(spec: any) : TagRenderingOptions{ + return new TagRenderingOptions(spec); + } + + +} \ No newline at end of file diff --git a/Customizations/Layout.ts b/Customizations/Layout.ts index 9baccb6..4dd18f2 100644 --- a/Customizations/Layout.ts +++ b/Customizations/Layout.ts @@ -41,6 +41,7 @@ export class Layout { */ public widenFactor: number = 0.07; public defaultBackground: string = "osm"; + public enableGeolocation: boolean = true; /** * diff --git a/Logic/Leaflet/GeoLocationHandler.ts b/Logic/Leaflet/GeoLocationHandler.ts index b80c8bd..4138326 100644 --- a/Logic/Leaflet/GeoLocationHandler.ts +++ b/Logic/Leaflet/GeoLocationHandler.ts @@ -79,14 +79,18 @@ export class GeoLocationHandler extends UIElement { } InnerRender(): string { + if(!State.state.featureSwitchGeolocation.data){ + return ""; + } + if (this._hasLocation.data) { - return "locate me"; + return "locate me"; } if (this._isActive.data) { - return "locate me"; + return "locate me"; } - return "locate me"; + return "locate me"; } diff --git a/State.ts b/State.ts index f3cb73d..e865444 100644 --- a/State.ts +++ b/State.ts @@ -93,6 +93,7 @@ export class State { public readonly featureSwitchIframe: UIEventSource; public readonly featureSwitchMoreQuests: UIEventSource; public readonly featureSwitchShareScreen: UIEventSource; + public readonly featureSwitchGeolocation: UIEventSource; /** @@ -152,6 +153,7 @@ export class State { this.featureSwitchIframe = featSw("fs-iframe", () => false); this.featureSwitchMoreQuests = featSw("fs-more-quests", () => layoutToUse?.enableMoreQuests); this.featureSwitchShareScreen = featSw("fs-share-screen", () => layoutToUse?.enableShareScreen); + this.featureSwitchGeolocation = featSw("fs-geolocation", () => layoutToUse?.enableGeolocation); this.osmConnection = new OsmConnection( QueryParameters.GetQueryParameter("test", "false").data === "true", diff --git a/UI/ShareScreen.ts b/UI/ShareScreen.ts index 34e299d..1e3088a 100644 --- a/UI/ShareScreen.ts +++ b/UI/ShareScreen.ts @@ -97,7 +97,8 @@ export class ShareScreen extends UIElement { {urlName: "fs-search", human: "Enable search bar"}, {urlName: "fs-welcome-message", human: "Enable the welcome message"}, {urlName: "fs-layers", human: "Enable layer control"}, - {urlName: "fs-add-new", human: "Enable the 'add new POI' button"} + {urlName: "fs-add-new", human: "Enable the 'add new POI' button"}, + {urlName: "fs-geolocation", human: "Enable the 'geolocate-me' button"} ] @@ -137,7 +138,7 @@ export class ShareScreen extends UIElement { this._iframeCode = new VariableUiElement( url.map((url) => { return ` - <iframe src="${url}" style="width:100%;height:100%" title="${layout.name} with MapComplete"></iframe> + <iframe src="${url}" width="100%" height="100%" title="${layout.name} with MapComplete"></iframe> ` }) ); diff --git a/index.ts b/index.ts index eb97202..9d3f362 100644 --- a/index.ts +++ b/index.ts @@ -166,7 +166,7 @@ InitUiElements.OnlyIf(State.state.featureSwitchWelcomeMessage, () => { InitUiElements.InitWelcomeMessage() }); -if ((window != window.top && !State.state.featureSwitchWelcomeMessage) || State.state.featureSwitchIframe.data) { +if ((window != window.top && !State.state.featureSwitchWelcomeMessage.data) || State.state.featureSwitchIframe.data) { new FixedUiElement(``).AttachTo("top-right") }