Closed shinu0720 closed 1 year ago
Hello! unfortunally this is currently a bug. I need to find how to fix it. You should use some workaround. I'm working on it.
Hello! Now it's fixed and it's working:
Here's your example.
import "./styles.css";
import {
ReactPhotoSphereViewer,
MarkersPlugin
} from "react-photo-sphere-viewer";
import React from "react";
function App() {
const pSRef = React.createRef();
const handleReady = (instance) => {
const markersPlugs = instance.getPlugin(MarkersPlugin);
if (!markersPlugs) return;
console.log(markersPlugs);
markersPlugs.addMarker({
id: "imageLayer2",
imageLayer: "drone.png",
size: { width: 220, height: 220 },
position: { yaw: "130.5deg", pitch: "-0.1deg" },
tooltip: "Image embedded in the scene"
});
markersPlugs.addEventListener("select-marker", () => {
console.log("asd");
});
};
const plugins = [
[
MarkersPlugin,
{
// list of markers
markers: [
{
// image marker that opens the panel when clicked
id: "image",
position: { yaw: "0.33deg", pitch: "0.1deg" },
image: "pin-blue.png",
anchor: "bottom center",
size: { width: 32, height: 32 },
tooltip: "Mountain peak. <b>Click me!</b>"
},
{
// image marker rendered in the 3D scene
id: "imageLayer",
imageLayer: "drone.png",
size: { width: 220, height: 220 },
position: { yaw: "13.5deg", pitch: "-0.1deg" },
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}
onReady={handleReady}
plugins={plugins}
></ReactPhotoSphereViewer>
</div>
);
}
export default App;
here is the code and i expected that i could have
console.log('asd')
but it does not work