forked from MapComplete/MapComplete
Feature(360): attempt to fix CSP
This commit is contained in:
parent
a30f25f42a
commit
558b19f8d7
5 changed files with 132 additions and 55 deletions
|
@ -25,6 +25,7 @@
|
|||
import { BBox } from "../../Logic/BBox"
|
||||
import PanoramaxLink from "../BigComponents/PanoramaxLink.svelte"
|
||||
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||
import type { PanoramaView } from "../../Logic/ImageProviders/ImageProvider"
|
||||
|
||||
export let tags: UIEventSource<OsmTags>
|
||||
export let state: SpecialVisualizationState
|
||||
|
@ -55,14 +56,16 @@
|
|||
let asFeatures = result.map((p4cs) =>
|
||||
p4cs.map(
|
||||
(p4c) =>
|
||||
<Feature<Point>>{
|
||||
<Feature<Point, PanoramaView>>{
|
||||
type: "Feature",
|
||||
geometry: {
|
||||
type: "Point",
|
||||
coordinates: [p4c.coordinates.lng, p4c.coordinates.lat]
|
||||
},
|
||||
properties: {
|
||||
properties: <PanoramaView>{
|
||||
id: p4c.pictureUrl,
|
||||
url: p4c.pictureUrl,
|
||||
northOffset: p4c.direction,
|
||||
rotation: p4c.direction,
|
||||
spherical: p4c.details.isSpherical ? "yes" : "no"
|
||||
}
|
||||
|
@ -145,15 +148,24 @@
|
|||
highlighted.set(feature.properties.id)
|
||||
}
|
||||
})
|
||||
let nearbyFeatures: Feature[] = [{
|
||||
type: "Feature",
|
||||
geometry: { type: "Point", coordinates: GeoOperations.centerpointCoordinates(feature) },
|
||||
properties: {
|
||||
name: layer.title?.GetRenderValue(feature.properties).Subs(feature.properties).txt,
|
||||
focus: true
|
||||
}
|
||||
}
|
||||
]
|
||||
let nearbyFeatures: Store<Feature[]> = asFeatures.map(nearbyPoints => {
|
||||
return [{
|
||||
type: "Feature",
|
||||
geometry: { type: "Point", coordinates: GeoOperations.centerpointCoordinates(feature) },
|
||||
properties: {
|
||||
name: layer.title?.GetRenderValue(feature.properties).Subs(feature.properties).txt,
|
||||
focus: true
|
||||
}
|
||||
}, ...nearbyPoints.filter(p => p.properties.spherical === "yes").map(f => ({
|
||||
...f, properties: {
|
||||
name: "Nearby panorama",
|
||||
pitch: "auto",
|
||||
type: "scene",
|
||||
gotoPanorama: f
|
||||
}
|
||||
}))
|
||||
]
|
||||
})
|
||||
|
||||
onDestroy(
|
||||
tags.addCallbackAndRunD((tags) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue