forked from MapComplete/MapComplete
Merge master
This commit is contained in:
commit
3659276351
84 changed files with 3508 additions and 3472 deletions
|
@ -3,7 +3,11 @@
|
|||
* The image preview allows to drag and zoom in to the image
|
||||
*/
|
||||
import panzoom from "panzoom"
|
||||
import type { HotspotProperties, PanoramaView, ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
|
||||
import type {
|
||||
HotspotProperties,
|
||||
PanoramaView,
|
||||
ProvidedImage,
|
||||
} from "../../Logic/ImageProviders/ImageProvider"
|
||||
import ImageProvider from "../../Logic/ImageProviders/ImageProvider"
|
||||
import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||
import Zoomcontrol from "../Zoomcontrol"
|
||||
|
@ -15,7 +19,7 @@
|
|||
export let nearbyFeatures:
|
||||
| Feature<Geometry, HotspotProperties>[]
|
||||
| Store<Feature<Geometry, HotspotProperties>[]> = []
|
||||
export let image: Partial<ProvidedImage> & { url: string, id: string }
|
||||
export let image: Partial<ProvidedImage> & { url: string; id: string }
|
||||
let panzoomInstance = undefined
|
||||
let panzoomEl: HTMLElement
|
||||
let viewerEl: HTMLElement
|
||||
|
@ -34,7 +38,7 @@
|
|||
return
|
||||
}
|
||||
const viewer = new PhotoSphereViewerWrapper(viewerEl, imageInfo)
|
||||
viewer.imageInfo.addCallbackAndRunD(panoramaInfo => {
|
||||
viewer.imageInfo.addCallbackAndRunD((panoramaInfo) => {
|
||||
let provider: ImageProvider
|
||||
if (typeof panoramaInfo.properties.provider === "string") {
|
||||
provider = AllImageProviders.byName(panoramaInfo.properties.provider)
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
export let feature: Feature
|
||||
export let layer: LayerConfig
|
||||
|
||||
|
||||
export let highlighted: UIEventSource<string> = undefined
|
||||
export let nearbyFeatures: Feature<Point, HotspotProperties>[] | Store<Feature<Point, HotspotProperties>[]> = []
|
||||
export let nearbyFeatures:
|
||||
| Feature<Point, HotspotProperties>[]
|
||||
| Store<Feature<Point, HotspotProperties>[]> = []
|
||||
export let linkable = true
|
||||
let targetValue = Object.values(image.osmTags)[0]
|
||||
let isLinked = new UIEventSource(Object.values(tags.data).some((v) => targetValue === v))
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
northOffset: p4c.direction,
|
||||
rotation: p4c.direction,
|
||||
spherical: p4c.details.isSpherical ? "yes" : "no",
|
||||
provider: p4c.provider
|
||||
provider: p4c.provider,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
|
|
@ -6,7 +6,8 @@ import { HotspotProperties, PanoramaView } from "../../Logic/ImageProviders/Imag
|
|||
import { Store, UIEventSource } from "../../Logic/UIEventSource"
|
||||
|
||||
export class PhotoSphereViewerWrapper {
|
||||
private _imageInfo: UIEventSource<NonNullable<Feature<Point, PanoramaView>>> = new UIEventSource(undefined)
|
||||
private _imageInfo: UIEventSource<NonNullable<Feature<Point, PanoramaView>>> =
|
||||
new UIEventSource(undefined)
|
||||
public imageInfo: Store<NonNullable<Feature<Point, PanoramaView>>> = this._imageInfo
|
||||
private readonly viewer: Pannellum.Viewer
|
||||
private nearbyFeatures: Feature<Geometry, HotspotProperties>[] = []
|
||||
|
@ -39,13 +40,12 @@ export class PhotoSphereViewerWrapper {
|
|||
compass: true,
|
||||
showControls: false,
|
||||
northOffset: imageInfo.properties.northOffset,
|
||||
horizonPitch: imageInfo.properties.pitchOffset
|
||||
horizonPitch: imageInfo.properties.pitchOffset,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
this.setNearbyFeatures(nearbyFeatures)
|
||||
|
||||
}
|
||||
|
||||
public calculatePitch(feature: Feature): number {
|
||||
|
@ -91,7 +91,6 @@ export class PhotoSphereViewerWrapper {
|
|||
this.viewer.loadScene(imageInfo.properties.url, 0, imageInfo.properties.northOffset)
|
||||
this.setNearbyFeatures(this.nearbyFeatures)
|
||||
this._imageInfo.set(imageInfo)
|
||||
|
||||
}
|
||||
|
||||
private clearHotspots() {
|
||||
|
|
|
@ -83,6 +83,6 @@
|
|||
<div class={sideTextClass}>{$sideTextSub}</div>
|
||||
{/if}
|
||||
</div>
|
||||
<a href={$url} target="_blank" class="subtle text-xs break-all">{$url}</a>
|
||||
<a href={$url} target="_blank" class="subtle break-all text-xs">{$url}</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue