facebook / Rapid

The OpenStreetMap editor driven by open data, AI, and supercharged features
https://rapideditor.org
ISC License
515 stars 91 forks source link

Photo Viewer: Adjust viewfield of image point on map as user pans around in 360 image using the photo editor #508

Closed Bonkles closed 1 year ago

Bonkles commented 2 years ago

In RapiD v1, selecting a 360 image pin and then using the photo viewer to 'pan' around dynamically adjusts the FOV marker on the map. Super slick. We should add this back in v2!

Image

Bonkles commented 1 year ago

All righty- initial code inspection and pointers from @bhousel indicate that this functionality used to be in the setStyles function- example in the V2.1 code here:

https://github.com/facebook/Rapid/blob/cea054297eb5738008c89a0226b52f0a9dbe05c3/modules/services/MapillaryService.js#L352-L368

There are similar setStyles methods in the Streetside and Kartaview services too.

Now, to find out how they are fired/handled.

Bonkles commented 1 year ago

For Mapillary, here's how the v1 code worked:

sequenceDiagram
participant Photo Viewer
participant Mapillary Service
loop Repeat while dragging left mouse
    Photo Viewer->>Mapillary Service: user drags pano photo 
    Mapillary Service->>onBearingChanged(): bearingChanged event w/ `bearing` in degrees
onBearingChanged()->>Mapillary Service: recalc rotation of pin w/CSS transform
end

For Bing streetside imagery the flow is very similar, but with an empty event called viewerChanged which must be handled by calling back to the service to get the current yaw and set the .css transform rotation with it.

Bonkles commented 1 year ago

This now works!

https://github.com/facebook/Rapid/assets/1887955/23a5f1c6-0a04-496f-837e-13adf883154b