Skip to content

Bug: Floating Marker #194

Description

@kirillakovalenko

Description

On the results page, the route stop markers on the Google Map do not stay pinned to their
geographic location when the map zoom level changes. The marker holds a constant pixel
distance
from the route path line rather than a fixed lat/lng point, so as the user zooms
out the marker visually drifts farther and farther from the road it belongs to. Zoomed in,
the marker sits correctly on the stop; zoomed all the way out, the path may render over
California while the marker appears over Washington. This is purely a visual/rendering bug —
the underlying coordinates are correct — but it makes users believe the optimized stop
location has changed.

The markers are rendered in
Map.tsx. The legacy Marker icon anchor is set
around Map.tsx:682-696, with a
fallback branch ({ url: iconUrl }) that supplies no anchor, and the icon
scaledSize/anchor depend on getMarkerScaledSize() returning a value
(Map.tsx:32-35). A missing or incorrect
anchor is the most likely cause of the marker not staying locked to its coordinate across
zoom levels — confirm during investigation.

Goal

Each stop marker stays visually pinned to its geographic location and the route path at every
zoom level.

Reproduction

Steps

  1. Run an optimization and open the results page with a route shown on the map.
  2. Observe a stop marker sitting correctly on the path at the default/zoomed-in level.
  3. Zoom the Google Map all the way out.

Expected: The marker stays anchored to its lat/lng on (or immediately adjacent to) the
route path at all zoom levels.
Actual: The marker keeps a fixed pixel gap from the path, so when zoomed out it appears
far from the road — e.g. path over California, marker over Washington — implying the location
changed.

Environment: main branch; results page map (@react-google-maps/api, Advanced Markers);
reproducible regardless of OS/browser.

Scope

In scope

  • Fix marker anchoring so stop markers track their geographic coordinate across all zoom
    levels in Map.tsx.
  • Ensure both the normal and fallback icon branches (with and without scaledSize) set a
    correct anchor.

Out of scope

  • Depot marker styling, hover overlay behavior
    (MapStopHoverOverlay.tsx), and
    edit-mode dragging logic.
  • Any change to the optimization output / coordinate data itself.

Acceptance Criteria

  • Stop markers stay pinned to their lat/lng on the route path at minimum, default, and
    maximum zoom levels (bug no longer reproduces via the steps above).
  • Both icon branches (with and without scaledSize) anchor the marker correctly.
  • No regression to marker hover, depot marker, or edit-mode drag behavior.

Assign

@KesarSidhu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions