forked from MapComplete/MapComplete
Refactoring: move all code files into a src directory
This commit is contained in:
parent
de99f56ca8
commit
e75d2789d2
389 changed files with 0 additions and 12 deletions
39
src/UI/Popup/MapillaryLinkVis.ts
Normal file
39
src/UI/Popup/MapillaryLinkVis.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||
import { ImmutableStore, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization"
|
||||
import { Feature } from "geojson"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import SvelteUIElement from "../Base/SvelteUIElement"
|
||||
import MapillaryLink from "../BigComponents/MapillaryLink.svelte"
|
||||
|
||||
export class MapillaryLinkVis implements SpecialVisualization {
|
||||
funcName = "mapillary_link"
|
||||
docs = "Adds a button to open mapillary on the specified location"
|
||||
args = [
|
||||
{
|
||||
name: "zoom",
|
||||
doc: "The startzoom of mapillary",
|
||||
defaultValue: "18",
|
||||
},
|
||||
]
|
||||
|
||||
public constr(
|
||||
state: SpecialVisualizationState,
|
||||
tagsSource: UIEventSource<Record<string, string>>,
|
||||
args: string[],
|
||||
feature: Feature
|
||||
): BaseUIElement {
|
||||
const [lon, lat] = GeoOperations.centerpointCoordinates(feature)
|
||||
let zoom = Number(args[0])
|
||||
if (isNaN(zoom)) {
|
||||
zoom = 18
|
||||
}
|
||||
return new SvelteUIElement(MapillaryLink, {
|
||||
mapProperties: {
|
||||
lat,
|
||||
lon,
|
||||
},
|
||||
zoom: new ImmutableStore(zoom),
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue