Merge branches, fix bugs with initial zoom and location, fix bug which starts loading right away, fix bug when overpass times out

This commit is contained in:
Pieter Vander Vennet 2020-09-18 00:31:54 +02:00
commit 638691d6c3
12 changed files with 105 additions and 50 deletions

View file

@ -23,11 +23,13 @@ export class FullScreenMessageBox extends UIElement {
this._uielement = new Combine([State.state.fullScreenMessage.data]).SetStyle(
"display:block;"+
"padding: 1em;"+
"padding-bottom:5em;"+
"padding-bottom:6em;"+
`margin-bottom:${FullScreenMessageBox._toTheMap_height};`+
"box-sizing:border-box;"+
`height:calc(100vh - ${FullScreenMessageBox._toTheMap_height});`+
"overflow-y: auto;" +
"max-width:100vw;" +
"overflow-x:hidden;" +
"background:white;"
);

View file

@ -16,37 +16,34 @@ export class LayerSelection extends UIElement {
this._checkboxes = [];
for (const layer of State.state.filteredLayers.data) {
const checkbox = Img.checkmark;
let icon : UIElement;
let iconUrl = "./asets/checkbox.svg";
let iconUrlBlank = "";
if (layer.layerDef.icon && layer.layerDef.icon !== "") {
icon = new FixedUiElement(`<img style="height:2em;max-width: 2em;" src="${layer.layerDef.icon}">`);
}else{
icon = new FixedUiElement(Img.checkmark);
iconUrl = layer.layerDef.icon as string;
iconUrlBlank = layer.layerDef.icon as string;
}
const icon = new FixedUiElement(`<img style="height:2em;max-width: 2em;" src="${iconUrl}">`);
let iconUnselected : UIElement;
if (layer.layerDef.icon && layer.layerDef.icon !== "") {
iconUnselected = new FixedUiElement(`<img style="height:2em;max-width: 2em;" src="${layer.layerDef.icon}">`);
}else{
iconUnselected = new FixedUiElement("");
}
iconUnselected.SetStyle("opacity:0.2");
let iconUnselected: UIElement;
iconUnselected = new FixedUiElement(`<img style="height:2em;max-width: 2em; opacity:0.2;" src="${iconUrl}">`);
const name = Translations.WT(layer.layerDef.name).Clone()
.SetStyle("font-size:large;margin-left: 0.5em;");
const zoomStatus = new VariableUiElement(State.state.locationControl.map(location => {
if(location.zoom < layer.layerDef.minzoom){
if (location.zoom < layer.layerDef.minzoom) {
return Translations.t.general.zoomInToSeeThisLayer
.SetClass("alert")
.SetStyle("display: block ruby;width:min-content;")
.Render();
}
return ""
}))
const style = "display:flex;align-items:center;"
this._checkboxes.push(new CheckBox(
new Combine([icon, name, zoomStatus]),
new Combine([iconUnselected, "<del>",name,"</del>", zoomStatus]),
new Combine([icon, name, zoomStatus]).SetStyle(style),
new Combine([iconUnselected, "<del>", name, "</del>", zoomStatus]).SetStyle(style),
layer.isDisplayed)
.SetStyle("margin:0.3em;")
);

View file

@ -47,6 +47,9 @@ export class SimpleAddUI extends UIElement {
const self = this;
for (const layer of State.state.filteredLayers.data) {
this.ListenTo(layer.isDisplayed);
for (const preset of layer.layerDef.presets) {
let icon: string = "./assets/bug.svg";
@ -136,6 +139,16 @@ export class SimpleAddUI extends UIElement {
const userDetails = State.state.osmConnection.userDetails;
if (this._confirmPreset.data !== undefined) {
if(!this._confirmPreset.data.layerToAddTo.isDisplayed.data){
return new Combine([
Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.layerDef.name})
.SetClass("alert"),
this.openLayerControl,
this.cancelButton
]).Render();
}
let tagInfo = "";
const csCount = State.state.osmConnection.userDetails.data.csCount;

View file

@ -159,7 +159,8 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
this._saveButton = new SaveButton(this._questionElement.GetValue())
.onClick(save);
this._friendlyLogin = Translations.t.general.loginToStart
this._friendlyLogin = Translations.t.general.loginToStart.Clone()
.SetClass("login-button-friendly")
.onClick(() => State.state.osmConnection.AttemptLogin())
this._editButton = new FixedUiElement("");
@ -463,12 +464,10 @@ export class TagRendering extends UIElement implements TagDependantUIElement {
this.ApplyTemplate(this._question).SetClass('question-text');
return "<div class='question'>" +
new Combine([
question.Render(),
question,
"<br/>",
this._questionElement,
"<span class='login-button-friendly'>",
this._friendlyLogin,
"</span>",
]).Render() + "</div>";
}

View file

@ -384,6 +384,11 @@ export default class Translations {
"en": "Open the layer control box",
"nl": "Open de laag-instellingen"
})
,
layerNotEnabled: new T({
"en": "The layer {layer} is not enabled. Enable this layer to add a point",
"nl": "De laag {layer} is gedeactiveerd. Activeer deze om een punt toe te voegn"
})
},
pickLanguage: new T({
en: "Choose a language",