pchen66/panolens.js

Removing Infospots and adding again (not rendered).

MartinPape opened this issue · 1 comments

Description

Hi,

I'm adding a list of Infospots with custom images to an ImagePanorama (works).
Then I'm removing all Infospots (by using the remove from ImagePanorama (works).
Now I'm adding these Infospots again. I can see they exist (click handler works), but they are not
rendered anymore.
I've already tried to call render() on the viewer, but this had no effect. Also the custom images doesn't seem to be the problem (I've tried without and had the same effect).
Any advice how make the Infospots show again?

Many thanks!

With this I could reproduce it in JSFiddle (https://jsfiddle.net/MartinPapeWaw/4ohb86va/16/):

      const panorama = new PANOLENS.ImagePanorama( 
      "https://pchen66.github.io/Panolens/examples/asset/textures/equirectangular/field.jpg" );
      const viewer = new PANOLENS.Viewer( { output: "console" } );
      viewer.add( panorama );
      
      var infospot1 = new PANOLENS.Infospot( 2 );
      infospot1.position.set(3.9,	1,	-20.3);
      panorama.add(infospot1);
      infospot1.addEventListener( "click", function(){
      	panorama.remove(infospot1);
      } );

      var infospot2 = new PANOLENS.Infospot( 2 );
      infospot2.position.set(2,	1,	-20.3);
      panorama.add(infospot2);
      infospot2.addEventListener( "click", function(){
          var infospot3 = new PANOLENS.Infospot( 2 );
          infospot3.position.set(3.9,	1,	-20.3);
          panorama.add(infospot3);
      } );
Panolens version
  • Master
  • Dev
Browser
  • Android webview
OS
  • [x ] Android

I solved this by changing the texture (infospot.material.map) of the infospots. So I don't need to remove and redraw them anymore.