I'm struggling to find out how to use Markers in my Next JS app.
I have got a basic panorama going with this code...
import React, { useEffect } from "react";
import Head from "next/head";
import { Viewer } from "photo-sphere-viewer";
export default function Home() {
const sphereElementRef = React.createRef();
useEffect(() => {
const shperePlayerInstance = new Viewer({
container: sphereElementRef.current,
panorama: "/images/pano2.jpg",
});
// unmount component instructions
return () => {
shperePlayerInstance.destroy();
};
}, []);
return (
<div>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/photo-sphere-viewer@4/dist/photo-sphere-viewer.min.css"
/>
</Head>
<main>
<div ref={sphereElementRef}></div>
</main>
</div>
);
}
So that's all well and good but I don't know how the Markers come into it. I've tried exactly like in the markers docs with
plugins: [
[PhotoSphereViewer.MarkersPlugin, {
markers: [
{
id: 'new-marker',
longitude: '45deg',
latitude: '0deg',
image: 'assets/pin-red.png',
},
],
}],
],
But get PSVError: Un undefined value was given for plugins.
and also just using
markers: [
{
id: 'image',
longitude: 0.2,
latitude: -0.13770,
....
},
But I just get
PSVError: Unknown option markers
Any ideas would be a great help
Here's my full viewer after working out how to do everything