forked from MapComplete/MapComplete
Auto-formatting
This commit is contained in:
parent
9e000d521f
commit
fed4cff878
26 changed files with 360 additions and 304 deletions
|
@ -5,7 +5,7 @@ import Loc from "../../Models/Loc"
|
|||
import BaseLayer from "../../Models/BaseLayer"
|
||||
import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers"
|
||||
import * as L from "leaflet"
|
||||
import {LeafletMouseEvent, Map} from "leaflet"
|
||||
import { LeafletMouseEvent, Map } from "leaflet"
|
||||
import Minimap, { MinimapObj, MinimapOptions } from "./Minimap"
|
||||
import { BBox } from "../../Logic/BBox"
|
||||
import "leaflet-polylineoffset"
|
||||
|
@ -317,7 +317,7 @@ export default class MinimapImplementation extends BaseUIElement implements Mini
|
|||
if (this._options.lastClickLocation) {
|
||||
const lastClickLocation = this._options.lastClickLocation
|
||||
map.on("click", function (e: LeafletMouseEvent) {
|
||||
if(e.originalEvent["dismissed"] ){
|
||||
if (e.originalEvent["dismissed"]) {
|
||||
return
|
||||
}
|
||||
lastClickLocation?.setData({ lat: e.latlng.lat, lon: e.latlng.lng })
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Svg from "../../Svg"
|
||||
import Combine from "./Combine"
|
||||
import {FixedUiElement} from "./FixedUiElement"
|
||||
import {UIEventSource} from "../../Logic/UIEventSource"
|
||||
import { FixedUiElement } from "./FixedUiElement"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import Hash from "../../Logic/Web/Hash"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import Title from "./Title"
|
||||
|
@ -71,20 +71,17 @@ export default class ScrollableFullScreen {
|
|||
}
|
||||
ScrollableFullScreen._currentlyOpen = self
|
||||
self.Activate()
|
||||
|
||||
} else {
|
||||
if(self.hashToShow !== undefined){
|
||||
if (self.hashToShow !== undefined) {
|
||||
Hash.hash.setData(undefined)
|
||||
}
|
||||
// Some cleanup...
|
||||
ScrollableFullScreen.collapse()
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private static initEmpty(): FixedUiElement{
|
||||
|
||||
private static initEmpty(): FixedUiElement {
|
||||
document.addEventListener("keyup", function (event) {
|
||||
if (event.code === "Escape") {
|
||||
ScrollableFullScreen.collapse()
|
||||
|
@ -93,9 +90,8 @@ export default class ScrollableFullScreen {
|
|||
})
|
||||
|
||||
return new FixedUiElement("")
|
||||
|
||||
}
|
||||
public static collapse(){
|
||||
public static collapse() {
|
||||
const fs = document.getElementById("fullscreen")
|
||||
if (fs !== null) {
|
||||
ScrollableFullScreen.empty.AttachTo("fullscreen")
|
||||
|
@ -103,8 +99,8 @@ export default class ScrollableFullScreen {
|
|||
}
|
||||
|
||||
const opened = ScrollableFullScreen._currentlyOpen
|
||||
if( opened !== undefined){
|
||||
opened?.isShown?.setData(false)
|
||||
if (opened !== undefined) {
|
||||
opened?.isShown?.setData(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +120,6 @@ export default class ScrollableFullScreen {
|
|||
fs.classList.remove("hidden")
|
||||
}
|
||||
|
||||
|
||||
private BuildComponent(title: BaseUIElement, content: BaseUIElement): BaseUIElement {
|
||||
const returnToTheMap = new Combine([
|
||||
Svg.back_svg().SetClass("block md:hidden w-12 h-12 p-2 svg-foreground"),
|
||||
|
|
|
@ -147,15 +147,11 @@ export default class CopyrightPanel extends Combine {
|
|||
imgSize,
|
||||
}
|
||||
),
|
||||
new SubtleButton(
|
||||
Svg.mastodon_ui(),
|
||||
t.followOnMastodon,
|
||||
{
|
||||
url: "https://en.osm.town/web/notifications",
|
||||
newTab: true,
|
||||
imgSize,
|
||||
}
|
||||
),
|
||||
new SubtleButton(Svg.mastodon_ui(), t.followOnMastodon, {
|
||||
url: "https://en.osm.town/web/notifications",
|
||||
newTab: true,
|
||||
imgSize,
|
||||
}),
|
||||
new OpenIdEditor(state, iconStyle),
|
||||
new MapillaryLink(state, iconStyle),
|
||||
new OpenJosm(state, iconStyle),
|
||||
|
|
|
@ -13,7 +13,7 @@ import { VariableUiElement } from "../Base/VariableUIElement"
|
|||
import FeatureInfoBox from "../Popup/FeatureInfoBox"
|
||||
import CopyrightPanel from "./CopyrightPanel"
|
||||
import FeaturePipelineState from "../../Logic/State/FeaturePipelineState"
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import { FixedUiElement } from "../Base/FixedUiElement"
|
||||
|
||||
export default class LeftControls extends Combine {
|
||||
constructor(
|
||||
|
@ -46,14 +46,11 @@ export default class LeftControls extends Combine {
|
|||
})
|
||||
).SetClass("inline-block w-full h-full")
|
||||
|
||||
|
||||
feature.map((feature) => {
|
||||
if (feature === undefined) {
|
||||
return undefined
|
||||
}
|
||||
const tagsSource = state.allElements.getEventSourceById(
|
||||
feature.properties.id
|
||||
)
|
||||
const tagsSource = state.allElements.getEventSourceById(feature.properties.id)
|
||||
return new FeatureInfoBox(tagsSource, currentViewFL.layerDef, state, {
|
||||
hashToShow: "currentview",
|
||||
isShown: guiState.currentViewControlIsOpened,
|
||||
|
@ -85,7 +82,6 @@ export default class LeftControls extends Combine {
|
|||
)
|
||||
)
|
||||
|
||||
|
||||
new ScrollableFullScreen(
|
||||
() => Translations.t.general.layerSelection.title.Clone(),
|
||||
() =>
|
||||
|
@ -96,8 +92,8 @@ export default class LeftControls extends Combine {
|
|||
guiState.filterViewIsOpened
|
||||
)
|
||||
const toggledFilter = new MapControlButton(Svg.layers_svg()).onClick(() =>
|
||||
guiState.filterViewIsOpened.setData(true)
|
||||
)
|
||||
guiState.filterViewIsOpened.setData(true)
|
||||
)
|
||||
|
||||
const filterButton = new Toggle(toggledFilter, undefined, state.featureSwitchFilter)
|
||||
|
||||
|
@ -110,22 +106,17 @@ export default class LeftControls extends Combine {
|
|||
// If the welcomeMessage is disabled, the copyright is hidden (as that is where the copyright is located
|
||||
const copyright = new Toggle(
|
||||
undefined,
|
||||
new Lazy(
|
||||
() =>
|
||||
{
|
||||
|
||||
new ScrollableFullScreen(
|
||||
() => Translations.t.general.attribution.attributionTitle,
|
||||
() => new CopyrightPanel(state),
|
||||
"copyright",
|
||||
guiState.copyrightViewIsOpened
|
||||
);
|
||||
return new MapControlButton(Svg.copyright_svg()).onClick(() =>
|
||||
guiState.copyrightViewIsOpened.setData(true)
|
||||
)
|
||||
|
||||
}
|
||||
),
|
||||
new Lazy(() => {
|
||||
new ScrollableFullScreen(
|
||||
() => Translations.t.general.attribution.attributionTitle,
|
||||
() => new CopyrightPanel(state),
|
||||
"copyright",
|
||||
guiState.copyrightViewIsOpened
|
||||
)
|
||||
return new MapControlButton(Svg.copyright_svg()).onClick(() =>
|
||||
guiState.copyrightViewIsOpened.setData(true)
|
||||
)
|
||||
}),
|
||||
state.featureSwitchWelcomeMessage
|
||||
)
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
|
||||
import Translations from "../i18n/Translations";
|
||||
import {OsmConnection} from "../../Logic/Osm/OsmConnection";
|
||||
import Combine from "../Base/Combine";
|
||||
import {SubtleButton} from "../Base/SubtleButton";
|
||||
import Svg from "../../Svg";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import Img from "../Base/Img";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import Link from "../Base/Link";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import Loc from "../../Models/Loc";
|
||||
import BaseUIElement from "../BaseUIElement";
|
||||
import ScrollableFullScreen from "../Base/ScrollableFullScreen"
|
||||
import Translations from "../i18n/Translations"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import Combine from "../Base/Combine"
|
||||
import { SubtleButton } from "../Base/SubtleButton"
|
||||
import Svg from "../../Svg"
|
||||
import { VariableUiElement } from "../Base/VariableUIElement"
|
||||
import Img from "../Base/Img"
|
||||
import { FixedUiElement } from "../Base/FixedUiElement"
|
||||
import Link from "../Base/Link"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import Loc from "../../Models/Loc"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import Showdown from "showdown"
|
||||
import LanguagePicker from "../LanguagePicker";
|
||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
|
||||
import Constants from "../../Models/Constants";
|
||||
import LanguagePicker from "../LanguagePicker"
|
||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||
import Constants from "../../Models/Constants"
|
||||
|
||||
export class ImportViewerLinks extends VariableUiElement {
|
||||
constructor(osmConnection: OsmConnection) {
|
||||
|
@ -37,22 +37,25 @@ export class ImportViewerLinks extends VariableUiElement {
|
|||
}
|
||||
|
||||
class UserInformationMainPanel extends Combine {
|
||||
constructor(osmConnection: OsmConnection, locationControl: UIEventSource<Loc>, layout: LayoutConfig) {
|
||||
const t = Translations.t.userinfo;
|
||||
constructor(
|
||||
osmConnection: OsmConnection,
|
||||
locationControl: UIEventSource<Loc>,
|
||||
layout: LayoutConfig
|
||||
) {
|
||||
const t = Translations.t.userinfo
|
||||
const imgSize = "h-6 w-6"
|
||||
const ud = osmConnection.userDetails;
|
||||
const ud = osmConnection.userDetails
|
||||
super([
|
||||
|
||||
new VariableUiElement(ud.map(ud => {
|
||||
|
||||
new VariableUiElement(
|
||||
ud.map((ud) => {
|
||||
if (!ud?.loggedIn) {
|
||||
// Not logged in
|
||||
return new SubtleButton(
|
||||
Svg.login_svg(), "Login", {imgSize}
|
||||
).onClick(osmConnection.AttemptLogin)
|
||||
return new SubtleButton(Svg.login_svg(), "Login", { imgSize }).onClick(
|
||||
osmConnection.AttemptLogin
|
||||
)
|
||||
}
|
||||
|
||||
let img: Img = Svg.person_svg();
|
||||
let img: Img = Svg.person_svg()
|
||||
if (ud.img !== undefined) {
|
||||
img = new Img(ud.img)
|
||||
}
|
||||
|
@ -64,69 +67,95 @@ class UserInformationMainPanel extends Combine {
|
|||
Svg.pencil_svg().SetClass("h-4 w-4"),
|
||||
"https://www.openstreetmap.org/profile/edit",
|
||||
true
|
||||
).SetClass("absolute block bg-subtle rounded-full p-2 bottom-2 right-2 w-min self-end")
|
||||
).SetClass(
|
||||
"absolute block bg-subtle rounded-full p-2 bottom-2 right-2 w-min self-end"
|
||||
)
|
||||
|
||||
description = new Combine([
|
||||
new FixedUiElement(new Showdown.Converter().makeHtml(ud.description)).SetClass("link-underline"),
|
||||
editButton
|
||||
new FixedUiElement(
|
||||
new Showdown.Converter().makeHtml(ud.description)
|
||||
).SetClass("link-underline"),
|
||||
editButton,
|
||||
]).SetClass("relative w-full m-2")
|
||||
|
||||
} else {
|
||||
description = new Combine([
|
||||
t.noDescription, new SubtleButton(Svg.pencil_svg(), t.noDescriptionCallToAction, {imgSize})
|
||||
t.noDescription,
|
||||
new SubtleButton(Svg.pencil_svg(), t.noDescriptionCallToAction, {
|
||||
imgSize,
|
||||
}),
|
||||
]).SetClass("w-full m-2")
|
||||
}
|
||||
|
||||
let panToHome: BaseUIElement;
|
||||
let panToHome: BaseUIElement
|
||||
if (ud.home) {
|
||||
panToHome = new SubtleButton(Svg.home_svg(), t.moveToHome, {imgSize})
|
||||
.onClick(() => {
|
||||
const home = ud?.home
|
||||
if (home === undefined) {
|
||||
return
|
||||
}
|
||||
locationControl.setData({...home, zoom: 16})
|
||||
}
|
||||
);
|
||||
panToHome = new SubtleButton(Svg.home_svg(), t.moveToHome, {
|
||||
imgSize,
|
||||
}).onClick(() => {
|
||||
const home = ud?.home
|
||||
if (home === undefined) {
|
||||
return
|
||||
}
|
||||
locationControl.setData({ ...home, zoom: 16 })
|
||||
})
|
||||
}
|
||||
|
||||
return new Combine([
|
||||
new Combine([img, description]).SetClass("flex border border-black rounded-md"),
|
||||
new LanguagePicker(layout.language, Translations.t.general.pickLanguage.Clone()),
|
||||
new Combine([img, description]).SetClass(
|
||||
"flex border border-black rounded-md"
|
||||
),
|
||||
new LanguagePicker(
|
||||
layout.language,
|
||||
Translations.t.general.pickLanguage.Clone()
|
||||
),
|
||||
|
||||
new SubtleButton(Svg.envelope_svg(), new Combine([t.gotoInbox,
|
||||
ud.unreadMessages == 0 ? undefined : t.newMessages.SetClass("alert block")
|
||||
new SubtleButton(
|
||||
Svg.envelope_svg(),
|
||||
new Combine([
|
||||
t.gotoInbox,
|
||||
ud.unreadMessages == 0
|
||||
? undefined
|
||||
: t.newMessages.SetClass("alert block"),
|
||||
]),
|
||||
{imgSize, url: `${ud.backend}/messages/inbox`, newTab: true}),
|
||||
new SubtleButton(Svg.gear_svg(), t.gotoSettings,
|
||||
{imgSize, url: `${ud.backend}/user/${encodeURIComponent(ud.name)}/account`, newTab: true}),
|
||||
{ imgSize, url: `${ud.backend}/messages/inbox`, newTab: true }
|
||||
),
|
||||
new SubtleButton(Svg.gear_svg(), t.gotoSettings, {
|
||||
imgSize,
|
||||
url: `${ud.backend}/user/${encodeURIComponent(ud.name)}/account`,
|
||||
newTab: true,
|
||||
}),
|
||||
panToHome,
|
||||
new ImportViewerLinks(osmConnection),
|
||||
new SubtleButton(Svg.logout_svg(), Translations.t.general.logout, {imgSize}).onClick(osmConnection.LogOut)
|
||||
|
||||
new SubtleButton(Svg.logout_svg(), Translations.t.general.logout, {
|
||||
imgSize,
|
||||
}).onClick(osmConnection.LogOut),
|
||||
])
|
||||
}
|
||||
)).SetClass("flex flex-col"),
|
||||
|
||||
|
||||
]);
|
||||
})
|
||||
).SetClass("flex flex-col"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
export default class UserInformationPanel extends ScrollableFullScreen {
|
||||
constructor(state: {
|
||||
layoutToUse: LayoutConfig;
|
||||
osmConnection: OsmConnection, locationControl: UIEventSource<Loc>
|
||||
layoutToUse: LayoutConfig
|
||||
osmConnection: OsmConnection
|
||||
locationControl: UIEventSource<Loc>
|
||||
}) {
|
||||
const t = Translations.t.general;
|
||||
const t = Translations.t.general
|
||||
super(
|
||||
() => {
|
||||
return new VariableUiElement(state.osmConnection.userDetails.map(ud => "Welcome " + ud.name))
|
||||
return new VariableUiElement(
|
||||
state.osmConnection.userDetails.map((ud) => "Welcome " + ud.name)
|
||||
)
|
||||
},
|
||||
() => {
|
||||
return new UserInformationMainPanel(state.osmConnection, state.locationControl, state.layoutToUse)
|
||||
return new UserInformationMainPanel(
|
||||
state.osmConnection,
|
||||
state.locationControl,
|
||||
state.layoutToUse
|
||||
)
|
||||
},
|
||||
"userinfo"
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ export default class DeleteWizard extends Toggle {
|
|||
return t.explanations.hardDelete
|
||||
}
|
||||
// This is a soft deletion: we explain _why_ the deletion is soft
|
||||
return t.explanations.softDelete.Subs({ reason: reason})
|
||||
return t.explanations.softDelete.Subs({ reason: reason })
|
||||
})
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {UIEventSource} from "../../Logic/UIEventSource"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import TagRenderingQuestion from "./TagRenderingQuestion"
|
||||
import Translations from "../i18n/Translations"
|
||||
import Combine from "../Base/Combine"
|
||||
|
@ -6,10 +6,10 @@ import TagRenderingAnswer from "./TagRenderingAnswer"
|
|||
import Toggle from "../Input/Toggle"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
||||
import {Unit} from "../../Models/Unit"
|
||||
import { Unit } from "../../Models/Unit"
|
||||
import Lazy from "../Base/Lazy"
|
||||
import {FixedUiElement} from "../Base/FixedUiElement"
|
||||
import {EditButton} from "./SaveButton"
|
||||
import { FixedUiElement } from "../Base/FixedUiElement"
|
||||
import { EditButton } from "./SaveButton"
|
||||
|
||||
export default class EditableTagRendering extends Toggle {
|
||||
constructor(
|
||||
|
@ -52,9 +52,9 @@ export default class EditableTagRendering extends Toggle {
|
|||
undefined,
|
||||
renderingIsShown
|
||||
)
|
||||
const self = this;
|
||||
editMode.addCallback(editing => {
|
||||
if(editing){
|
||||
const self = this
|
||||
editMode.addCallback((editing) => {
|
||||
if (editing) {
|
||||
console.log("Scrolling etr into view")
|
||||
self.ScrollIntoView()
|
||||
}
|
||||
|
@ -91,18 +91,16 @@ export default class EditableTagRendering extends Toggle {
|
|||
})
|
||||
)
|
||||
|
||||
const answerWithEditButton = new Combine([
|
||||
const answerWithEditButton = new Combine([
|
||||
answer,
|
||||
new EditButton(state.osmConnection, () => {
|
||||
editMode.setData(true)
|
||||
question.ScrollIntoView({
|
||||
onlyIfPartiallyHidden:true
|
||||
onlyIfPartiallyHidden: true,
|
||||
})
|
||||
|
||||
}),
|
||||
]).SetClass("flex justify-between w-full")
|
||||
rendering = new Toggle(question, answerWithEditButton, editMode)
|
||||
|
||||
}
|
||||
return rendering
|
||||
}
|
||||
|
|
|
@ -79,11 +79,15 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
|
|||
public static GenerateContent(
|
||||
tags: UIEventSource<any>,
|
||||
layerConfig: LayerConfig,
|
||||
state: FeaturePipelineState): BaseUIElement{
|
||||
state: FeaturePipelineState
|
||||
): BaseUIElement {
|
||||
return new Toggle(
|
||||
new Combine([Svg.delete_icon_svg().SetClass("w-8 h-8"), Translations.t.delete.isDeleted]).SetClass("flex justify-center font-bold items-center") ,
|
||||
new Combine([
|
||||
Svg.delete_icon_svg().SetClass("w-8 h-8"),
|
||||
Translations.t.delete.isDeleted,
|
||||
]).SetClass("flex justify-center font-bold items-center"),
|
||||
FeatureInfoBox.GenerateMainContent(tags, layerConfig, state),
|
||||
tags.map(t => t["_deleted"] == "yes")
|
||||
tags.map((t) => t["_deleted"] == "yes")
|
||||
)
|
||||
}
|
||||
private static GenerateMainContent(
|
||||
|
@ -91,7 +95,6 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
|
|||
layerConfig: LayerConfig,
|
||||
state: FeaturePipelineState
|
||||
): BaseUIElement {
|
||||
|
||||
let questionBoxes: Map<string, QuestionBox> = new Map<string, QuestionBox>()
|
||||
const t = Translations.t.general
|
||||
const allGroupNames = Utils.Dedup(layerConfig.tagRenderings.map((tr) => tr.group))
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
import {SubtleButton} from "../Base/SubtleButton"
|
||||
import { SubtleButton } from "../Base/SubtleButton"
|
||||
import Combine from "../Base/Combine"
|
||||
import Svg from "../../Svg"
|
||||
import {OsmConnection} from "../../Logic/Osm/OsmConnection"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import Toggle from "../Input/Toggle"
|
||||
import {UIEventSource} from "../../Logic/UIEventSource"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import Translations from "../i18n/Translations"
|
||||
import {VariableUiElement} from "../Base/VariableUIElement"
|
||||
import {Translation} from "../i18n/Translation"
|
||||
import { VariableUiElement } from "../Base/VariableUIElement"
|
||||
import { Translation } from "../i18n/Translation"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import LocationInput from "../Input/LocationInput"
|
||||
import Loc from "../../Models/Loc"
|
||||
import {GeoOperations} from "../../Logic/GeoOperations"
|
||||
import {OsmObject} from "../../Logic/Osm/OsmObject"
|
||||
import {Changes} from "../../Logic/Osm/Changes"
|
||||
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||
import { OsmObject } from "../../Logic/Osm/OsmObject"
|
||||
import { Changes } from "../../Logic/Osm/Changes"
|
||||
import ChangeLocationAction from "../../Logic/Osm/Actions/ChangeLocationAction"
|
||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||
import MoveConfig from "../../Models/ThemeConfig/MoveConfig"
|
||||
import {ElementStorage} from "../../Logic/ElementStorage"
|
||||
import { ElementStorage } from "../../Logic/ElementStorage"
|
||||
import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers"
|
||||
import BaseLayer from "../../Models/BaseLayer"
|
||||
import SearchAndGo from "../BigComponents/SearchAndGo";
|
||||
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction";
|
||||
import {And} from "../../Logic/Tags/And";
|
||||
import {Tag} from "../../Logic/Tags/Tag";
|
||||
import SearchAndGo from "../BigComponents/SearchAndGo"
|
||||
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
|
||||
import { And } from "../../Logic/Tags/And"
|
||||
import { Tag } from "../../Logic/Tags/Tag"
|
||||
|
||||
interface MoveReason {
|
||||
text: Translation | string
|
||||
|
@ -71,7 +71,7 @@ export default class MoveWizard extends Toggle {
|
|||
includeSearch: true,
|
||||
startZoom: 12,
|
||||
minZoom: 6,
|
||||
eraseAddressFields: true
|
||||
eraseAddressFields: true,
|
||||
})
|
||||
}
|
||||
if (options.enableImproveAccuracy) {
|
||||
|
@ -85,7 +85,7 @@ export default class MoveWizard extends Toggle {
|
|||
background: "photo",
|
||||
startZoom: 17,
|
||||
minZoom: 16,
|
||||
eraseAddressFields: false
|
||||
eraseAddressFields: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ export default class MoveWizard extends Toggle {
|
|||
let searchPanel: BaseUIElement = undefined
|
||||
if (reason.includeSearch) {
|
||||
searchPanel = new SearchAndGo({
|
||||
leafletMap: locationInput.leafletMap
|
||||
leafletMap: locationInput.leafletMap,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -186,12 +186,14 @@ export default class MoveWizard extends Toggle {
|
|||
|
||||
if (reason.eraseAddressFields) {
|
||||
await state.changes.applyAction(
|
||||
new ChangeTagAction(featureToMove.properties.id,
|
||||
new And([new Tag("addr:housenumber", ""),
|
||||
new ChangeTagAction(
|
||||
featureToMove.properties.id,
|
||||
new And([
|
||||
new Tag("addr:housenumber", ""),
|
||||
new Tag("addr:street", ""),
|
||||
new Tag("addr:city", ""),
|
||||
new Tag("addr:postcode","")]
|
||||
),
|
||||
new Tag("addr:postcode", ""),
|
||||
]),
|
||||
featureToMove.properties,
|
||||
{
|
||||
changeType: "relocated",
|
||||
|
|
|
@ -33,7 +33,7 @@ export default class QuestionBox extends VariableUiElement {
|
|||
.filter((tr) => tr.question !== undefined)
|
||||
.filter((tr) => tr.question !== null)
|
||||
|
||||
let focus: () => void = () => {};
|
||||
let focus: () => void = () => {}
|
||||
|
||||
const tagRenderingQuestions = tagRenderings.map(
|
||||
(tagRendering, i) =>
|
||||
|
@ -53,7 +53,6 @@ export default class QuestionBox extends VariableUiElement {
|
|||
skippedQuestions.data.push(i)
|
||||
skippedQuestions.ping()
|
||||
focus()
|
||||
|
||||
}),
|
||||
})
|
||||
)
|
||||
|
@ -141,8 +140,9 @@ export default class QuestionBox extends VariableUiElement {
|
|||
|
||||
this.skippedQuestions = skippedQuestions
|
||||
this.restingQuestions = questionsToAsk
|
||||
focus = () => this.ScrollIntoView({
|
||||
onlyIfPartiallyHidden: true
|
||||
})
|
||||
focus = () =>
|
||||
this.ScrollIntoView({
|
||||
onlyIfPartiallyHidden: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import {Store, UIEventSource} from "../../Logic/UIEventSource"
|
||||
import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import {ShowDataLayerOptions} from "./ShowDataLayerOptions"
|
||||
import {ElementStorage} from "../../Logic/ElementStorage"
|
||||
import { ShowDataLayerOptions } from "./ShowDataLayerOptions"
|
||||
import { ElementStorage } from "../../Logic/ElementStorage"
|
||||
import RenderingMultiPlexerFeatureSource from "../../Logic/FeatureSource/Sources/RenderingMultiPlexerFeatureSource"
|
||||
import ScrollableFullScreen from "../Base/ScrollableFullScreen"
|
||||
import {LeafletMouseEvent} from "leaflet";
|
||||
import Hash from "../../Logic/Web/Hash";
|
||||
import { LeafletMouseEvent } from "leaflet"
|
||||
import Hash from "../../Logic/Web/Hash"
|
||||
/*
|
||||
// import 'leaflet-polylineoffset';
|
||||
We don't actually import it here. It is imported in the 'MinimapImplementation'-class, which'll result in a patched 'L' object.
|
||||
|
@ -43,7 +43,10 @@ export default class ShowDataLayerImplementation {
|
|||
* Note: the key of this dictionary is 'feature.properties.id+features.geometry.type' as one feature might have multiple presentations
|
||||
* @private
|
||||
*/
|
||||
private readonly leafletLayersPerId = new Map<string, { feature: any; activateFunc: (event: LeafletMouseEvent) => void }>()
|
||||
private readonly leafletLayersPerId = new Map<
|
||||
string,
|
||||
{ feature: any; activateFunc: (event: LeafletMouseEvent) => void }
|
||||
>()
|
||||
private readonly showDataLayerid: number
|
||||
private readonly createPopup: (
|
||||
tags: UIEventSource<any>,
|
||||
|
@ -324,18 +327,18 @@ export default class ShowDataLayerImplementation {
|
|||
return
|
||||
}
|
||||
const key = feature.properties.id
|
||||
if(this.leafletLayersPerId.has(key)){
|
||||
if (this.leafletLayersPerId.has(key)) {
|
||||
const activate = this.leafletLayersPerId.get(key)
|
||||
leafletLayer.addEventListener('click', activate.activateFunc)
|
||||
if(Hash.hash.data === key ){
|
||||
leafletLayer.addEventListener("click", activate.activateFunc)
|
||||
if (Hash.hash.data === key) {
|
||||
activate.activateFunc(null)
|
||||
}
|
||||
return;
|
||||
return
|
||||
}
|
||||
let infobox: ScrollableFullScreen = undefined
|
||||
const self = this
|
||||
|
||||
function activate (event: LeafletMouseEvent) {
|
||||
function activate(event: LeafletMouseEvent) {
|
||||
if (infobox === undefined) {
|
||||
const tags =
|
||||
self.allElements?.getEventSourceById(key) ??
|
||||
|
@ -348,25 +351,26 @@ export default class ShowDataLayerImplementation {
|
|||
})
|
||||
}
|
||||
infobox.Activate()
|
||||
self._selectedElement.setData( self.allElements.ContainingFeatures.get(feature.id) ?? feature )
|
||||
self._selectedElement.setData(
|
||||
self.allElements.ContainingFeatures.get(feature.id) ?? feature
|
||||
)
|
||||
event?.originalEvent?.preventDefault()
|
||||
event?.originalEvent?.stopPropagation()
|
||||
event?.originalEvent?.stopImmediatePropagation()
|
||||
if(event?.originalEvent){
|
||||
if (event?.originalEvent) {
|
||||
// This is a total workaround, as 'preventDefault' and everything above seems to be not working
|
||||
event.originalEvent["dismissed"] = true
|
||||
}
|
||||
}
|
||||
|
||||
leafletLayer.addEventListener('click', activate)
|
||||
|
||||
leafletLayer.addEventListener("click", activate)
|
||||
|
||||
// Add the feature to the index to open the popup when needed
|
||||
this.leafletLayersPerId.set(key, {
|
||||
feature: feature,
|
||||
activateFunc: activate,
|
||||
})
|
||||
if(Hash.hash.data === key ){
|
||||
if (Hash.hash.data === key) {
|
||||
activate(null)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue