Add some tweaks to hide the add-poi-marker when a layer is enabled

This commit is contained in:
Pieter Vander Vennet 2020-09-17 23:53:57 +02:00
parent 77e065d6e7
commit 15f816e172
5 changed files with 30 additions and 8 deletions

View file

@ -378,8 +378,7 @@ export class InitUiElements {
, ,
new Combine([Img.closedFilterButton]) new Combine([Img.closedFilterButton])
.SetStyle("display:block;border-radius:50%;background:white;padding:1em;"), .SetStyle("display:block;border-radius:50%;background:white;padding:1em;"),
QueryParameters.GetQueryParameter("layer-control-toggle", "false") State.state.layerControlIsOpened
.map((str) => str !== "false", [], b => "" + b)
); );
checkbox checkbox
.AttachTo("layer-selection"); .AttachTo("layer-selection");

View file

@ -15,6 +15,16 @@ export class StrayClickHandler {
this._uiToShow = uiToShow; this._uiToShow = uiToShow;
const self = this; const self = this;
const map = State.state.bm.map; const map = State.state.bm.map;
State.state.filteredLayers.data.forEach((filteredLayer) => {
filteredLayer.isDisplayed.addCallback(isEnabled => {
if(isEnabled){
// When a layer is activated, we remove the 'last click location' in order to force the user to reclick
// This reclick might be at a location where a feature now appeared...
map.removeLayer(self._lastMarker);
}
})
})
State.state.bm.LastClickLocation.addCallback(function (lastClick) { State.state.bm.LastClickLocation.addCallback(function (lastClick) {
State.state.selectedElement.setData(undefined); State.state.selectedElement.setData(undefined);

View file

@ -22,7 +22,7 @@ export class State {
// The singleton of the global state // The singleton of the global state
public static state: State; public static state: State;
public static vNumber = "0.0.8a"; public static vNumber = "0.0.8b";
// The user journey states thresholds when a new feature gets unlocked // The user journey states thresholds when a new feature gets unlocked
public static userJourney = { public static userJourney = {
@ -114,8 +114,11 @@ export class State {
public layoutDefinition: string; public layoutDefinition: string;
public installedThemes: UIEventSource<{ layout: Layout; definition: string }[]>; public installedThemes: UIEventSource<{ layout: Layout; definition: string }[]>;
public welcomeMessageOpenedTab = QueryParameters.GetQueryParameter("tab","0").map<number>( public layerControlIsOpened: UIEventSource<boolean> = QueryParameters.GetQueryParameter("layer-control-toggle", "false")
str => isNaN(Number(str)) ? 0 : Number(str),[],n => ""+n .map<boolean>((str) => str !== "false", [], b => "" + b)
public welcomeMessageOpenedTab = QueryParameters.GetQueryParameter("tab", "0").map<number>(
str => isNaN(Number(str)) ? 0 : Number(str), [], n => "" + n
); );
constructor(layoutToUse: Layout) { constructor(layoutToUse: Layout) {

View file

@ -27,6 +27,7 @@ export class SimpleAddUI extends UIElement {
}> }>
= new UIEventSource(undefined); = new UIEventSource(undefined);
private confirmButton: UIElement = undefined; private confirmButton: UIElement = undefined;
private openLayerControl: UIElement;
private cancelButton: UIElement; private cancelButton: UIElement;
private goToInboxButton: UIElement = new SubtleButton("./assets/envelope.svg", private goToInboxButton: UIElement = new SubtleButton("./assets/envelope.svg",
Translations.t.general.goToInbox, {url:"https://www.openstreetmap.org/messages/inbox", newTab: false}); Translations.t.general.goToInbox, {url:"https://www.openstreetmap.org/messages/inbox", newTab: false});
@ -100,19 +101,24 @@ export class SimpleAddUI extends UIElement {
} }
) )
this._addButtons.push(button); this._addButtons.push(button);
} }
} }
this.cancelButton = new SubtleButton( this.cancelButton = new SubtleButton(
"./assets/close.svg", "./assets/close.svg",
Translations.t.general.cancel Translations.t.general.cancel
).onClick(() => { ).onClick(() => {
self._confirmPreset.setData(undefined); self._confirmPreset.setData(undefined);
}) })
this.openLayerControl = new SubtleButton(
"./assets/layers.svg",
Translations.t.general.add.openLayerControl
).onClick(() => {
State.state.layerControlIsOpened.setData(true);
})
} }
private CreatePoint(tags: Tag[], layerToAddTo: FilteredLayer) { private CreatePoint(tags: Tag[], layerToAddTo: FilteredLayer) {

View file

@ -379,6 +379,10 @@ export default class Translations {
fr: "Ajouter un/une {category} ici", fr: "Ajouter un/une {category} ici",
gl: "Engadir {category} aquí", gl: "Engadir {category} aquí",
de: "Hier eine {category} hinzufügen" de: "Hier eine {category} hinzufügen"
}),
openLayerControl: new T({
"en": "Open the layer control box",
"nl": "Open de laag-instellingen"
}) })
}, },
pickLanguage: new T({ pickLanguage: new T({