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

Image Cover Effect: Is it possible to force image to always "point" to the street? #590

Closed
ivensgoncalves opened this issue Jul 18, 2023 · 2 comments

Comments

@ivensgoncalves
Copy link

Basic information

MapillaryJS version: 4.1.1
When Mapillary instance dimension has larger width size compared to height size, image does apply "css cover effect" and street gets hidden for some images, having the impression camera is pointing to the sky.

And when user "corrects" the camera position, when he/she clicks the forward arrow, mapillary does re-center vertically the camera again. Is there a way to "keep" the angle of the camera when you move forward or backward?

I am aware of the LetterBox RenderMode, but I was trying to find a solution for full width render.

So, basically my 2 questions are:

  1. Is it possible to make camera always pointing to the street?
  2. If not, is it possible to "keep" camera angle after user manually corrects it?

Thanks in advance.

Steps to Reproduce Behavior

  1. Create mapillary Viewer instance with larger width compared to height
  2. Use some specific image ids, such as 317263166462858 or 791034201550956 or 824286068471618
  3. Open in the browser and activate mapillary instance: Camera will look like pointing to the sky

Code Sample

https://codesandbox.io/s/zealous-shadow-mwcrp9
(Open in new window to visualize it better)

Additional information

image

@oscarlorentzon
Copy link
Member

oscarlorentzon commented Jul 21, 2023

@ivensgoncalves Thanks for the question.

There is currently no way to achieve achieve what you are asking for in a smooth way. With the Street camera controls the Viewer always centers the Viewpoint when moving to a new image.

It is possible to change the viewpoint non-smoothly programatically using the Viewer.setCenter method method (see the Viewer - Core Functionality - Viewpoint example), e.g. every time after a new image has been selected and the viewer has stopped moving (see the image and moveend events). For your use case I do not think that would result in a particularly nice behavior though. Also, with the Street camera controls active there is always the "risk" that it will bounce back towards the center depending on the undistortion model for the current image as well as the aspect ratio of the current image and the viewer container.

The proper solution (which is significantly more time consuming) is to add a new type of freer camera control that does not bounce towards the center of the image and maintains a lookat vector relative to the center of the image when transitioning between images. That camera control would be implemented as a new state next to the TraversingState which is the backing implementation for the Street camera controls.

@ivensgoncalves
Copy link
Author

@oscarlorentzon Thank you for your detailed explanation.

I will try to follow your suggestion.

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

No branches or pull requests

2 participants