Closed
Description
import "./styles.css";
import {
ReactPhotoSphereViewer,
MarkersPlugin
} from "react-photo-sphere-viewer";
import React from "react";
function App() {
//const photoSphereRef = React.createRef();
const [markersManager, setMarkerManager] = React.useState();
const pSRef = React.useCallback((node) => {
const markersPlugs = node?.getPlugin(MarkersPlugin);
setMarkerManager(markersPlugs);
}, []);
React.useEffect(() => {
if (markersManager) {
console.log(markersManager);
}
}, [markersManager]);
const plugins = [
[
MarkersPlugin,
{
// list of markers
markers: [
{
// image marker that opens the panel when clicked
id: "image",
longitude: 0.33,
latitude: 0.1,
image: "pin-blue.png",
width: 32,
height: 32,
anchor: "bottom center",
tooltip: "Mountain peak. <b>Click me!</b>"
},
{
// image marker rendered in the 3D scene
id: "imageLayer",
imageLayer: "drone.png",
width: 220,
height: 220,
longitude: 13.5,
latitude: -0.1,
tooltip: "Image embedded in the scene"
}
]
}
]
];
const handleClick = (data) => {
console.log(data);
};
return (
<div className="App">
<ReactPhotoSphereViewer
ref={pSRef}
src="Test_Pano.jpg"
height={"100vh"}
width={"100%"}
littlePlanet={false}
onClick={handleClick}
plugins={plugins}
></ReactPhotoSphereViewer>
</div>
);
}
export default App;
It's currently difficult to manage the marker plugins methods.