perf(monitor): synchronize map follow frames
This commit is contained in:
@@ -524,7 +524,10 @@ export function FleetMap({ vehicles, selectedVin, onSelect, monitorMap, onSelect
|
||||
const label = labelMarkersRef.current.get(motion.point.id);
|
||||
label?.marker.setPosition?.(motion.point.lnglat);
|
||||
if (label) label.position = motion.point.lnglat;
|
||||
if (selectedVinRef.current === motion.point.id) selectionRef.current?.setPosition?.(motion.point.lnglat);
|
||||
if (selectedVinRef.current === motion.point.id) {
|
||||
selectionRef.current?.setPosition?.(motion.point.lnglat);
|
||||
if (followSelectedRef.current) mapRef.current?.setCenter?.(motion.point.lnglat);
|
||||
}
|
||||
}
|
||||
};
|
||||
const schedule = () => {
|
||||
@@ -653,8 +656,8 @@ export function FleetMap({ vehicles, selectedVin, onSelect, monitorMap, onSelect
|
||||
if (currentZoom < 15) mapRef.current.setZoomAndCenter?.(15, mapPosition);
|
||||
else mapRef.current.panTo?.(mapPosition, MAP_INTERACTION_PAN_DURATION_MS);
|
||||
centeredVinRef.current = selectedVin;
|
||||
} else if (selectionPositionRef.current && selectionPositionRef.current !== positionKey && followSelectedRef.current) {
|
||||
mapRef.current.panTo?.(mapPosition, pointMoveDurationMs(target.reportIntervalMs));
|
||||
} else if (selectionPositionRef.current && selectionPositionRef.current !== positionKey && followSelectedRef.current && !movingPointIDsRef.current.has(selectedVin)) {
|
||||
mapRef.current.panTo?.(mapPosition, MAP_INTERACTION_PAN_DURATION_MS);
|
||||
}
|
||||
const previousPositionKey = selectionPositionRef.current;
|
||||
selectionPositionRef.current = positionKey;
|
||||
|
||||
Reference in New Issue
Block a user