Small fixes, add geolocation feature switch
This commit is contained in:
parent
97a69ff903
commit
de9bb13568
6 changed files with 38 additions and 6 deletions
24
Customizations/JSON/TagRenderingParser.ts
Normal file
24
Customizations/JSON/TagRenderingParser.ts
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ export class Layout {
|
||||||
*/
|
*/
|
||||||
public widenFactor: number = 0.07;
|
public widenFactor: number = 0.07;
|
||||||
public defaultBackground: string = "osm";
|
public defaultBackground: string = "osm";
|
||||||
|
public enableGeolocation: boolean = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,14 +79,18 @@ export class GeoLocationHandler extends UIElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
InnerRender(): string {
|
InnerRender(): string {
|
||||||
if (this._hasLocation.data) {
|
if(!State.state.featureSwitchGeolocation.data){
|
||||||
return "<img src='assets/crosshair-blue.png' alt='locate me'>";
|
return "";
|
||||||
}
|
|
||||||
if (this._isActive.data) {
|
|
||||||
return "<img src='assets/crosshair-blue-center.png' alt='locate me'>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<img src='assets/crosshair.png' alt='locate me'>";
|
if (this._hasLocation.data) {
|
||||||
|
return "<img src='assets/crosshair-blue.svg' alt='locate me'>";
|
||||||
|
}
|
||||||
|
if (this._isActive.data) {
|
||||||
|
return "<img src='assets/crosshair-blue-center.svg' alt='locate me'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<img src='assets/crosshair.svg' alt='locate me'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
State.ts
2
State.ts
|
@ -93,6 +93,7 @@ export class State {
|
||||||
public readonly featureSwitchIframe: UIEventSource<boolean>;
|
public readonly featureSwitchIframe: UIEventSource<boolean>;
|
||||||
public readonly featureSwitchMoreQuests: UIEventSource<boolean>;
|
public readonly featureSwitchMoreQuests: UIEventSource<boolean>;
|
||||||
public readonly featureSwitchShareScreen: UIEventSource<boolean>;
|
public readonly featureSwitchShareScreen: UIEventSource<boolean>;
|
||||||
|
public readonly featureSwitchGeolocation: UIEventSource<boolean>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,6 +153,7 @@ export class State {
|
||||||
this.featureSwitchIframe = featSw("fs-iframe", () => false);
|
this.featureSwitchIframe = featSw("fs-iframe", () => false);
|
||||||
this.featureSwitchMoreQuests = featSw("fs-more-quests", () => layoutToUse?.enableMoreQuests);
|
this.featureSwitchMoreQuests = featSw("fs-more-quests", () => layoutToUse?.enableMoreQuests);
|
||||||
this.featureSwitchShareScreen = featSw("fs-share-screen", () => layoutToUse?.enableShareScreen);
|
this.featureSwitchShareScreen = featSw("fs-share-screen", () => layoutToUse?.enableShareScreen);
|
||||||
|
this.featureSwitchGeolocation = featSw("fs-geolocation", () => layoutToUse?.enableGeolocation);
|
||||||
|
|
||||||
this.osmConnection = new OsmConnection(
|
this.osmConnection = new OsmConnection(
|
||||||
QueryParameters.GetQueryParameter("test", "false").data === "true",
|
QueryParameters.GetQueryParameter("test", "false").data === "true",
|
||||||
|
|
|
@ -97,7 +97,8 @@ export class ShareScreen extends UIElement {
|
||||||
{urlName: "fs-search", human: "Enable search bar"},
|
{urlName: "fs-search", human: "Enable search bar"},
|
||||||
{urlName: "fs-welcome-message", human: "Enable the welcome message"},
|
{urlName: "fs-welcome-message", human: "Enable the welcome message"},
|
||||||
{urlName: "fs-layers", human: "Enable layer control"},
|
{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(
|
this._iframeCode = new VariableUiElement(
|
||||||
url.map((url) => {
|
url.map((url) => {
|
||||||
return `<span class='literal-code iframe-code-block'>
|
return `<span class='literal-code iframe-code-block'>
|
||||||
<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>
|
||||||
</span>`
|
</span>`
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
2
index.ts
2
index.ts
|
@ -166,7 +166,7 @@ InitUiElements.OnlyIf(State.state.featureSwitchWelcomeMessage, () => {
|
||||||
InitUiElements.InitWelcomeMessage()
|
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(`<a href='${window.location}' target='_blank'><span class='iframe-escape'><img src='assets/pop-out.svg'></span></a>`).AttachTo("top-right")
|
new FixedUiElement(`<a href='${window.location}' target='_blank'><span class='iframe-escape'><img src='assets/pop-out.svg'></span></a>`).AttachTo("top-right")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue