Skip to content

Commit c0015eb

Browse files
committed
fix(map): reduce iOS pinch-zoom pressure on Leaflet
- Disable zoom, marker, and fade animations on the map instance. - Document why preferCanvas stays off (dual-color dashed routes, popups). - Reposition marker popover on moveend/zoomend instead of every move/zoom frame.
1 parent e6427af commit c0015eb

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/pages/MapPage/MarkerActionPopover.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ const MarkerActionPopover = ({
5858
useEffect(() => {
5959
if (!map) return;
6060
const onMapChange = () => syncPosition();
61-
map.on("move", onMapChange);
62-
map.on("zoom", onMapChange);
61+
map.on("moveend", onMapChange);
62+
map.on("zoomend", onMapChange);
6363
map.on("resize", onMapChange);
6464
return () => {
65-
map.off("move", onMapChange);
66-
map.off("zoom", onMapChange);
65+
map.off("moveend", onMapChange);
66+
map.off("zoomend", onMapChange);
6767
map.off("resize", onMapChange);
6868
};
6969
}, [map, syncPosition]);

src/pages/MapPage/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,14 @@ const MapPage = () => {
566566
if (mapEl._leaflet_id != null) delete mapEl._leaflet_id;
567567
mapContainer.innerHTML = "";
568568

569-
mapRef.current = L.map("map", { zoomControl: false }).setView([31.42, 34.49], 13);
569+
mapRef.current = L.map("map", {
570+
zoomControl: false,
571+
// Do not set preferCanvas: true — it forces route polylines onto Canvas, where
572+
// dashOffset / stacked dashed strokes (dual-color proposed segments) render incorrectly.
573+
zoomAnimation: false,
574+
markerZoomAnimation: false,
575+
fadeAnimation: false,
576+
}).setView([31.42, 34.49], 13);
570577
ensurePriorityPinkOverlayPane(mapRef.current);
571578
const baseTile = createBasemapTileLayer("satellite").addTo(mapRef.current);
572579
baseMapLayerRef.current = baseTile;

0 commit comments

Comments
 (0)