import {UIElement} from "./UIElement"; import {UIEventSource} from "./UIEventSource"; import {Tag} from "../Logic/TagsFilter"; import {FilteredLayer} from "../Logic/FilteredLayer"; import {Changes} from "../Logic/Changes"; import {FixedUiElement} from "./Base/FixedUiElement"; import {Button} from "./Base/Button"; import {UserDetails} from "../Logic/OsmConnection"; import Translations from "./i18n/Translations"; import Combine from "./Base/Combine"; /** * Asks to add a feature at the last clicked location, at least if zoom is sufficient */ export class SimpleAddUI extends UIElement { private _zoomlevel: UIEventSource<{ zoom: number }>; private _addButtons: UIElement[]; private _lastClickLocation: UIEventSource<{ lat: number; lon: number }>; private _changes: Changes; private _selectedElement: UIEventSource<{feature: any}>; private _dataIsLoading: UIEventSource; private _userDetails: UIEventSource; constructor(zoomlevel: UIEventSource<{ zoom: number }>, lastClickLocation: UIEventSource<{ lat: number, lon: number }>, changes: Changes, selectedElement: UIEventSource<{feature: any}>, dataIsLoading: UIEventSource, userDetails: UIEventSource, addButtons: { name: UIElement; icon: string; tags: Tag[]; layerToAddTo: FilteredLayer }[], ) { super(zoomlevel); this._zoomlevel = zoomlevel; this._lastClickLocation = lastClickLocation; this._changes = changes; this._selectedElement = selectedElement; this._dataIsLoading = dataIsLoading; this._userDetails = userDetails; this.ListenTo(userDetails); this.ListenTo(dataIsLoading); this._addButtons = []; for (const option of addButtons) { //