Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Is there any way to add info spot dynamically by click user ? #398

Open
soheilhasanjani opened this issue May 23, 2022 · 2 comments
Open
Assignees

Comments

@soheilhasanjani
Copy link

Hi , Is there any way to add info spot dynamically by click user ? for example , add event Listener for click , when user click any where , get me x, y ,z and i create a new info spot with this detail and add to panorama . please give me solution .

@JoseManuelFV
Copy link

Yes, you can use addEventListener to listen left click, and if you like control right click use contextmenu event

And for get actual position i use raycaster:

//Raycaster
viewer.raycaster.intersectObject(viewer.panorama, true);
clickPosition = intersectObjs[0].point;

//If you like check if exist infospot in same position
isInfospot = intersectObjs.filter(e=>e.object.type == "infospot");

// add you hostpot
infospot = new this.PANOLENS.Infospot();
// x position is inverted, i don't know why, but that's how it is
infospot.position.set( clickPosition.x * -1, clickPosition.y, clickPosition.z );
viewer.panorama.add(infospot);
viewer.paronama.toggleInfospotVisibility(true);

@hungvo2010
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants