Add some tweaks to hide the add-poi-marker when a layer is enabled
This commit is contained in:
parent
77e065d6e7
commit
15f816e172
5 changed files with 30 additions and 8 deletions
|
@ -378,8 +378,7 @@ export class InitUiElements {
|
|||
,
|
||||
new Combine([Img.closedFilterButton])
|
||||
.SetStyle("display:block;border-radius:50%;background:white;padding:1em;"),
|
||||
QueryParameters.GetQueryParameter("layer-control-toggle", "false")
|
||||
.map((str) => str !== "false", [], b => "" + b)
|
||||
State.state.layerControlIsOpened
|
||||
);
|
||||
checkbox
|
||||
.AttachTo("layer-selection");
|
||||
|
|
|
@ -15,6 +15,16 @@ export class StrayClickHandler {
|
|||
this._uiToShow = uiToShow;
|
||||
const self = this;
|
||||
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.selectedElement.setData(undefined);
|
||||
|
||||
|
|
9
State.ts
9
State.ts
|
@ -22,7 +22,7 @@ export class State {
|
|||
// The singleton of the global 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
|
||||
public static userJourney = {
|
||||
|
@ -114,8 +114,11 @@ export class State {
|
|||
public layoutDefinition: string;
|
||||
public installedThemes: UIEventSource<{ layout: Layout; definition: string }[]>;
|
||||
|
||||
public welcomeMessageOpenedTab = QueryParameters.GetQueryParameter("tab","0").map<number>(
|
||||
str => isNaN(Number(str)) ? 0 : Number(str),[],n => ""+n
|
||||
public layerControlIsOpened: UIEventSource<boolean> = QueryParameters.GetQueryParameter("layer-control-toggle", "false")
|
||||
.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) {
|
||||
|
|
|
@ -27,6 +27,7 @@ export class SimpleAddUI extends UIElement {
|
|||
}>
|
||||
= new UIEventSource(undefined);
|
||||
private confirmButton: UIElement = undefined;
|
||||
private openLayerControl: UIElement;
|
||||
private cancelButton: UIElement;
|
||||
private goToInboxButton: UIElement = new SubtleButton("./assets/envelope.svg",
|
||||
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.cancelButton = new SubtleButton(
|
||||
"./assets/close.svg",
|
||||
Translations.t.general.cancel
|
||||
).onClick(() => {
|
||||
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) {
|
||||
|
|
|
@ -379,6 +379,10 @@ export default class Translations {
|
|||
fr: "Ajouter un/une {category} ici",
|
||||
gl: "Engadir {category} aquí",
|
||||
de: "Hier eine {category} hinzufügen"
|
||||
}),
|
||||
openLayerControl: new T({
|
||||
"en": "Open the layer control box",
|
||||
"nl": "Open de laag-instellingen"
|
||||
})
|
||||
},
|
||||
pickLanguage: new T({
|
||||
|
|
Loading…
Reference in a new issue