Generated with the help of an LLM.
Problem/Motivation
The map of the split viewer formatter (mapillary_leaflet_split_viewer) marks the image with Leaflet's default pin. When the viewer moves to another image, the pin follows, but the map never shows which way the camera looks: turning the view in the viewer changes nothing on the map. In a panorama, the map cannot tell the user which side of the street they are looking at.
An image without a position puts the pin at 0, 0, on a world map at zoom 2.
Steps to reproduce
- Show a
mapillary_image_referencefield with the "Mapillary Leaflet Split Viewer" formatter and view a node. - Drag the image in the viewer to turn the camera: the pin on the map stays the same.
- Reference an image whose
geometryis empty and view the node again: the pin is at 0, 0.
Proposed resolution
- The pin becomes a marker for the image shown in the viewer: a dot with a viewing cone, drawn as an
L.divIconwith CSS inmapillary-split-viewer.css. The map does not rotate, so a CSSrotate()on the cone is enough. - The cone follows the viewer's
bearingevent (degrees clockwise from north). Its opening angle is fixed. - Until the viewer has opened and reported a bearing ("On click", a full page, no browser token), the marker shows only the dot.
- The
imageevent moves the marker and the map as today. Without a stored position there is no marker until the viewer reports the image's position. - Only JavaScript and CSS change; the formatter's markup and settings stay the same.
- Tests: the fake MapillaryJS of
mapillary_viewer_testkeeps the handlers registered withon(), can fire an event, and gets amoveTo(). A FunctionalJavascript test checks that the marker moves onimage, that the cone turns onbearing, that there is no cone before the viewer opens, and that there is no marker for an image without a position. - A "Changed" entry under
[Unreleased]inCHANGELOG.md: the split viewer no longer uses Leaflet's default marker icon, so theme CSS aimed at.leaflet-marker-iconin the split viewer no longer applies. - Upgrade path: no setting, schema or markup changes, so there is no update function.
This builds on the viewer loading of #3633914: Let the viewer formatters open the viewer on click and limit the viewers on a page.
Remaining tasks
- Implementation and tests.
- Merge request.
- Review.
User interface changes
- The split viewer's map shows a dot with a viewing cone instead of Leaflet's pin; the cone turns with the viewer.
API changes
None.
Data model changes
None.
Issue fork mapillary-3633965
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #6
orkutmuratyilmaz