mistic100 / Photo-Sphere-Viewer

A JavaScript library to display 360° sphere panoramas.
https://photo-sphere-viewer.js.org
MIT License
1.89k stars 681 forks source link

MarkerPlugin Hover events no longer firing after update to 5.8.1 #1340

Closed AndyBaird closed 3 months ago

AndyBaird commented 3 months ago

Describe your problem

I am testing the updates on 5.8.1 and noticed the enter-marker events stopped firing everywhere. I am utilizing the VirtualTourPlugin as well. Are we still supposed to utilize that method in the markersPlugin when using the virtualTourPlugin?

Online demo URL

No response

Photo Sphere Viewer version

5.8.1

Plugins loaded

markersPlugin, galleryPlugin, gyroscopePlugin, virtualTourPlugin

Additional context

This no longer works after moving to 5.8.1:

  markersPlugin.addEventListener(
    "enter-marker",
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    //@ts-ignore
    ({ marker }) => {
      // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
      const link = getLinkFromInternalMarker(marker);
      if (link) {
        setHoveredLink(link);
      }
    },
  );
mistic100 commented 3 months ago

What di you mean "stopped firing everywhere" ? can you give a concrete example of expected behaviour (setup and demo using version 5.7.4 on stackblitz or other)

AndyBaird commented 3 months ago

Diagnosing it further, the problem does not appear to be the event listener itself, but the markersPlugin. I found that when updating to 5.8.1 the markers object inside of the markersPlugin is null:

5.8.1 markersPlugin object:

image

5.7.4 markersPlugin object:

image
mistic100 commented 3 months ago

Yes because the virtual tour plugin does not use markers anymore as stated in the 5.8.0 changelog.

You might use events of the virtual tour plugin instead https://photo-sphere-viewer.js.org/api/modules/virtualtourplugin.events

AndyBaird commented 3 months ago

Understood, shifting to the enter-arrow events will work. I thought those events were still only applicable to the arrows in 3d mode and not markers. Perhaps that part of the guide can be updated for clarity. Thanks!

image
mistic100 commented 3 months ago

Updated the doc to remove the outdated statement