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

  1. Show a mapillary_image_reference field with the "Mapillary Leaflet Split Viewer" formatter and view a node.
  2. Drag the image in the viewer to turn the camera: the pin on the map stays the same.
  3. Reference an image whose geometry is 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.divIcon with CSS in mapillary-split-viewer.css. The map does not rotate, so a CSS rotate() on the cone is enough.
  • The cone follows the viewer's bearing event (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 image event 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_test keeps the handlers registered with on(), can fire an event, and gets a moveTo(). A FunctionalJavascript test checks that the marker moves on image, that the cone turns on bearing, 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] in CHANGELOG.md: the split viewer no longer uses Leaflet's default marker icon, so theme CSS aimed at .leaflet-marker-icon in 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

Command icon 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

orkutmuratyilmaz created an issue. See original summary.

orkutmuratyilmaz’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.