forked from MapComplete/MapComplete
Cleaning filtered layer
This commit is contained in:
parent
8e5e249e6b
commit
314894085a
12 changed files with 232 additions and 280 deletions
|
@ -8,34 +8,13 @@ import Combine from "./Base/Combine";
|
|||
*/
|
||||
export class FullScreenMessageBox extends UIElement {
|
||||
|
||||
private static readonly _toTheMap_height : string = "5em";
|
||||
|
||||
private readonly returnToTheMap: UIElement;
|
||||
private _content: UIElement;
|
||||
|
||||
constructor(onClear: (() => void)) {
|
||||
super();
|
||||
super(State.state.fullScreenMessage);
|
||||
this.HideOnEmpty(true);
|
||||
const self = this;
|
||||
State.state.fullScreenMessage.addCallbackAndRun(uiElement => {
|
||||
self.Update();
|
||||
if (uiElement === undefined) {
|
||||
location.hash = "";
|
||||
} else {
|
||||
// The 'hash' makes sure a new piece of history is added. This makes the 'back-button' on android remove the popup
|
||||
location.hash = "#element";
|
||||
}
|
||||
});
|
||||
|
||||
if (window !== undefined) {
|
||||
window.onhashchange = function () {
|
||||
if (location.hash === "") {
|
||||
// No more element: back to the map!
|
||||
State.state.fullScreenMessage.setData(undefined);
|
||||
onClear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.returnToTheMap =
|
||||
new Combine([Translations.t.general.returnToTheMap.Clone().SetStyle("font-size:xx-large")])
|
||||
|
@ -44,7 +23,7 @@ export class FullScreenMessageBox extends UIElement {
|
|||
"z-index: 10000;" +
|
||||
"bottom: 0;" +
|
||||
"left: 0;" +
|
||||
`height: ${FullScreenMessageBox._toTheMap_height};` +
|
||||
`height: var(--return-to-the-map-height);` +
|
||||
"width: 100vw;" +
|
||||
"color: var(--catch-detail-color-contrast);" +
|
||||
"font-weight: bold;" +
|
||||
|
@ -55,10 +34,8 @@ export class FullScreenMessageBox extends UIElement {
|
|||
"padding-bottom: 1.2em;" +
|
||||
"box-sizing:border-box")
|
||||
.onClick(() => {
|
||||
console.log("Returning...")
|
||||
State.state.fullScreenMessage.setData(undefined);
|
||||
onClear();
|
||||
self.Update();
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -73,9 +50,9 @@ export class FullScreenMessageBox extends UIElement {
|
|||
"display:block;" +
|
||||
"padding: 1em;" +
|
||||
"padding-bottom:6em;" +
|
||||
`margin-bottom:${FullScreenMessageBox._toTheMap_height};` +
|
||||
`margin-bottom: var(--return-to-the-map-height);` +
|
||||
"box-sizing:border-box;" +
|
||||
`height:calc(100vh - ${FullScreenMessageBox._toTheMap_height});` +
|
||||
`height:calc(100vh - var(--return-to-the-map-height));` +
|
||||
"overflow-y: auto;" +
|
||||
"max-width:100vw;" +
|
||||
"overflow-x:hidden;" +
|
||||
|
|
|
@ -68,7 +68,6 @@ export default class DirectionInput extends InputElement<string> {
|
|||
|
||||
htmlElement.ontouchstart = (ev: TouchEvent) => {
|
||||
onPosChange(ev.touches[0].clientX, ev.touches[0].clientY);
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
let isDown = false;
|
||||
|
|
|
@ -27,24 +27,25 @@ export default class EditableTagRendering extends UIElement {
|
|||
this.ListenTo(this._editMode);
|
||||
this.ListenTo(State.state?.osmConnection?.userDetails)
|
||||
|
||||
const self = this;
|
||||
|
||||
this._answer = new TagRenderingAnswer(tags, configuration);
|
||||
|
||||
this._answer.SetStyle("width:100%;")
|
||||
|
||||
if (this._configuration.question !== undefined) {
|
||||
// 2.3em total width
|
||||
if(State.state.featureSwitchUserbadge.data){
|
||||
|
||||
this._editButton =
|
||||
Svg.pencil_svg().SetClass("edit-button")
|
||||
.onClick(() => {
|
||||
self._editMode.setData(true);
|
||||
});
|
||||
if (State.state.featureSwitchUserbadge.data) {
|
||||
// 2.3em total width
|
||||
const self = this;
|
||||
this._editButton =
|
||||
Svg.pencil_svg().SetClass("edit-button")
|
||||
.onClick(() => {
|
||||
self._editMode.setData(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private GenerateQuestion() {
|
||||
const self = this;
|
||||
if (this._configuration.question !== undefined) {
|
||||
// And at last, set up the skip button
|
||||
const cancelbutton =
|
||||
Translations.t.general.cancel.Clone()
|
||||
|
@ -53,7 +54,7 @@ export default class EditableTagRendering extends UIElement {
|
|||
self._editMode.setData(false)
|
||||
});
|
||||
|
||||
this._question = new TagRenderingQuestion(tags, configuration,
|
||||
return new TagRenderingQuestion(this._tags, this._configuration,
|
||||
() => {
|
||||
self._editMode.setData(false)
|
||||
},
|
||||
|
@ -65,6 +66,7 @@ export default class EditableTagRendering extends UIElement {
|
|||
InnerRender(): string {
|
||||
|
||||
if (this._editMode.data) {
|
||||
this._question = this.GenerateQuestion();
|
||||
return this._question.Render();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,6 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
const inputEl = new InputElementMap<number[], TagsFilter>(
|
||||
checkBoxes,
|
||||
(t0, t1) => {
|
||||
console.log("IsEquiv?",t0, t1, t0?.isEquivalent(t1))
|
||||
return t0?.isEquivalent(t1) ?? false
|
||||
},
|
||||
(indices) => {
|
||||
|
@ -162,8 +161,6 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
}
|
||||
|
||||
}
|
||||
console.log(indices, freeformExtras);
|
||||
|
||||
if (freeformField) {
|
||||
if (freeformExtras.length > 0) {
|
||||
freeformField.GetValue().setData(new Tag(this._configuration.freeform.key, freeformExtras.join(";")));
|
||||
|
|
|
@ -8,7 +8,6 @@ import Locale from "./i18n/Locale";
|
|||
import State from "../State";
|
||||
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
import {Img} from "./Img";
|
||||
import Svg from "../Svg";
|
||||
|
||||
/**
|
||||
|
@ -115,8 +114,8 @@ export class SimpleAddUI extends UIElement {
|
|||
|
||||
const loc = State.state.bm.LastClickLocation.data;
|
||||
let feature = State.state.changes.createElement(tags, loc.lat, loc.lon);
|
||||
layerToAddTo.AddNewElement(feature);
|
||||
State.state.selectedElement.setData(feature);
|
||||
layerToAddTo.AddNewElement(feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue