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

Markers in MarkersPlugin cause node markers from VirtualTourPlugin to disappear #734

Closed
mikepianka opened this issue Aug 24, 2022 · 9 comments
Labels
Milestone

Comments

@mikepianka
Copy link

Sorry for all the questions lately! Is there an official example of a virtual tour using manual positionMode and markers renderMode? I am trying to set up a small example and while I can see my node on the compass, I cannot see it in the scene.

image

It is defined like this:

        [
          VirtualTourPlugin,
          {
            dataMode: "client",
            positionMode: "manual",
            renderMode: "markers",
            startNodeId: "node-1",
            nodes: [
              {
                id: "node-1",
                panorama: "./assets/pano.jpg",
                name: "One",
                links: [
                  {
                    nodeId: "node-2",
                    latitude: 0,
                    longitude: 0,
                    markerStyle: {
                      html: null, // needed for other marker styles
                      id: "temppp",
                      square: 30,
                      latitude: "0deg",
                      longitude: "0deg",
                      svgStyle: {
                        fill: "rgba(200, 0, 0, 0.2)",
                        stroke: "rgba(200, 0, 50, 0.8)",
                        strokeWidth: "2px",
                      },
                    },
                  },
                ],
              },
              {
                id: "node-2",
                panorama: "./assets/pano_2.jpg",
                name: "Two",
                links: [
                  { nodeId: "node-1", latitude: "0deg", longitude: "0deg" },
                ],
              },
            ],
          },
        ],
@mistic100
Copy link
Owner

mistic100 commented Aug 24, 2022

Looks like a long lasting bug in the markers plugin : square should be transformed to rect as there is not squares in SVG. Use rect: [30, 30] instead until it is fixed.


You should remove id, longitude, latitude from the marker style definition, just for the sake of cleanliness.
Reference : https://github.com/mistic100/Photo-Sphere-Viewer/blob/dev/src/plugins/virtual-tour/index.js#L590-L598

@mistic100 mistic100 added this to the 4.7.1 milestone Aug 24, 2022
@mistic100 mistic100 added the bug label Aug 24, 2022
@mikepianka
Copy link
Author

Thanks, but after those changes I still don't see the square.

Code:

        [
          VirtualTourPlugin,
          {
            dataMode: "client",
            positionMode: "manual",
            renderMode: "markers",
            startNodeId: "node-1",
            nodes: [
              {
                id: "node-1",
                panorama: "./assets/pano.jpg",
                name: "One",
                links: [
                  {
                    nodeId: "node-2",
                    latitude: 0,
                    longitude: 0,
                    markerStyle: {
                      html: null, // needed for other marker styles
                      rect: [30, 30],
                      svgStyle: {
                        fill: "rgba(200, 0, 0, 0.2)",
                        stroke: "rgba(200, 0, 50, 0.8)",
                        strokeWidth: "2px",
                      },
                    },
                  },
                ],
              },
              {
                id: "node-2",
                panorama: "./assets/pano_2.jpg",
                name: "Two",
                links: [
                  { nodeId: "node-1", latitude: "0deg", longitude: "0deg" },
                ],
              },
            ],
          },
        ],

@mistic100
Copy link
Owner

mistic100 commented Aug 24, 2022

Well post a repro on jsfiddle. I just tested it on the example file, it works for me.

@mikepianka
Copy link
Author

I actually just noticed that the red pin that should be on the lighthouse is missing in the virtual tour example in the docs. If you hover the cursor in that spot the tooltip displays but the marker is not visible. Same problem?

image

@mistic100
Copy link
Owner

No that's just because the URL was wrong, I fixed the demo.

@mikepianka
Copy link
Author

mikepianka commented Aug 25, 2022

OK I figured out the problem. If you have markers defined in the marker plugin, they will cause any node markers from the virtual tour to not be shown. If this is not possible an error should be thrown. I think it would be a good idea to leave it possible though so that a reoccurring general marker could be shown as an overlay on all virtual tour images.

First example of virtual tour in manual mode with markers working fine: https://jsfiddle.net/3vjhrnpy
image

Second example where adding a circle marker causes the virtual tour markers to disappear: https://jsfiddle.net/3vjhrnpy/1/
image

@mikepianka mikepianka changed the title Manual virtual tour with markers example Markers in MarkersPlugin cause node markers from VirtualTourPlugin to disappear Aug 25, 2022
@mistic100
Copy link
Owner

That's a tricky problem because :

  • the markers plugin calls setMarkers on init, which clear all markers
  • the virtual tour plugin calls clearMarkers when changing node (and then setMarkers if the node has additional markers)

I think this behavior makes sense if we consider each node independant in term of configuration.

What you can do is configure the same markers on each node.

@mistic100
Copy link
Owner

I will add a warning and clear the config if this case happens

No default markers can be configured on Markers plugin when using VirtualTour plugin. Consider defining markers on each tour node.

@github-actions
Copy link

github-actions bot commented Sep 3, 2022

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

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