Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes markers do not appear when clicking on the panorama #1241

Closed
Fernando-Checa opened this issue Feb 15, 2024 · 13 comments
Closed

Sometimes markers do not appear when clicking on the panorama #1241

Fernando-Checa opened this issue Feb 15, 2024 · 13 comments
Labels
Milestone

Comments

@Fernando-Checa
Copy link

Describe the bug

Sometimes when I create a marker it does not appear on the screen.
The tooltip show when I hover over the spot though.
In this case I created one marker and the second did not appear.
CleanShot 2024-02-15 at 22 06 23

then if I move the view or create a new marker it appears.
CleanShot 2024-02-15 at 22 09 25

This also happens sometimes at first load. The panorama loads, I create the markers all at once and they do not appear until I move the view.

Is there a way to force rendering the markers?

Online demo URL

No response

Photo Sphere Viewer version

5.7.1

Plugins loaded

markersPlugin

OS & browser

Tested with Safari and Brave

Additional context

No response

@mistic100
Copy link
Owner

Code ?

@Fernando-Checa
Copy link
Author

Here is the method:

viewer.setPanorama(baseUrl + panoUrl + myPanos[currentPano], createPanoObj(currentPano))
           .then(() => { 
                   viewer.rotate({
                       yaw: panosConfig[currentPano].defaultYaw,
                       pitch: panosConfig[currentPano].defaultPitch,
                  })
                  viewer.zoom(panosConfig[currentPano].defaultZoomLvl)
          });


function createPanoObj(id){
     let pano = myPanos[id];
     let config = panosConfig[id]

     return {
       defaultYaw: config.defaultYaw,
       defaultPitch: config.defaultPitch,
       defaultZoomLvl: config.defaultZoomLvl,
       minFov: config.minFov,
       maxFov: config.maxFov,
       caption: config.caption,
       loadingImg: config.loadingImg,
       navbar: [
         'autorotate',
         'zoom',
         'moveLeft',
         'moveRight',
         'fullscreen',
         'markers',
         'markersList',
         'caption',
         'description',
         {
           id: 'I',
           title: 'Info',
           content: '<img src="'+iconUrl+'info.svg" height="22">',
           onClick: function() {
   
             },
         }
       ],
       plugins:[
         [CompassPlugin, {
           hotspots: [
           { yaw: '0deg' },
           { yaw: '90deg' },
           { yaw: '180deg', color: 'yellow' },
           { yaw: '270deg' },
           ],
           size: '80px',
         }],
         [MarkersPlugin, {
           gotoMarkerSpeed: '6rpm',
           markers: []
           }]
       ]
     }
   };

Also when changing panorama with this method, yaw and pitch stay the same as in the previous panorama (using the same viewer) and new yaw and pitch are ignored. That's why I need to rotate() the view after loading.
Is this how it's supposed to be?

@mistic100
Copy link
Owner

mistic100 commented Feb 16, 2024

For your problem with "setPanorama" this is because you don't use rights parameters at all. Here you are passing something looking like an initial configuration (with plugins and all), but "setPanorama" does not accept that. Check the API https://photo-sphere-viewer.js.org/api/classes/core.viewer#setPanorama

I'll look at the other problem later.

@mistic100
Copy link
Owner

mistic100 commented Feb 16, 2024

Your example code does not contain anything related to creating markers... Please create a live demo on jsfiddle or other service (each example on the documentation has a button to setup a demo)

@Fernando-Checa
Copy link
Author

Fernando-Checa commented Feb 16, 2024

I didn't realize the options for setPanorama() were different. My mistake.
I'll pay more attention to the API in the future.
Thank you for pointing that out.

That solved the problem with the initial position of new panoramas, but not quite.
When loading a new panorama with different position, loads the new panorama and then animates to the new position.
Is it possible to load the new panorama in the same position so it does not move?

This might not be possible depending on how the viewer is used I guess.

I'll check the API for the markers and prepare a demo

@mistic100
Copy link
Owner

transition: false or transition: 'fade-only'

@Fernando-Checa
Copy link
Author

Fernando-Checa commented Feb 16, 2024

Yes, but then I don't get the fade affect.
I would like to have the panorama already in place but fading to the new one.

If fade-only is active, then the old panorama not only fades to the new one but also animates to the new position.

@mistic100
Copy link
Owner

It does not https://jsfiddle.net/Le82jmhd/

@Fernando-Checa
Copy link
Author

The default value for transition is true.
As the default behavior has also fade I wrongly assumed that was the same as fade-only.
So not declaring transition fades AND moves to the new position in the new panorama.

https://jsfiddle.net/ferpando/q038ohsz/

This is not clear in the docs

@mistic100
Copy link
Owner

The default value is indicated in the doc

Capture d’écran du 2024-02-16 13-58-45

I am sorry there are so many options and behaviours I cannot be exaustive, you have to try by yourself.

@Fernando-Checa
Copy link
Author

Yes it is indicated but is not clear what true does (animate + fade).
I understand keeping this organized is a lot of work.
You are doing a great job and I really appreciate your fast response and dedication.
Just pointing out things that could help others.

@Fernando-Checa
Copy link
Author

Fernando-Checa commented Feb 16, 2024

Here is the demo

https://jsfiddle.net/ferpando/Lh7ndzke/1/

sometimes the marker is not shown when created (but the rest of the functionality is working)
If you move the panorama, then it appears

@mistic100 mistic100 added this to the 5.7.2 milestone Feb 17, 2024
Copy link

github-actions bot commented Mar 5, 2024

This feature/bug fix has been released in version 5.7.2.

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

No branches or pull requests

2 participants