ai-coding
2026-07-29 20f556154e7bbe5edff3d6d1cc64f6f17ba950f0
fix(robotaxi): 查看运营区域时禁用地图中心点吸附逻辑

Co-Authored-By: 卢春龙 <lucl@xiaopeng.com>
2个文件已修改
19 ■■■■■ 已修改文件
src/pages/robotaxi/home/hooks/use-navigation.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/hooks/use-region-change.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/hooks/use-navigation.ts
@@ -70,7 +70,7 @@
    forceNearestSite?: boolean;
  }) => void;
  /** 查询指针吸附 */
  queryPointerByCenter: (lat: number, lng: number) => Promise<void>;
  queryPointerByCenter: (lat: number, lng: number, options?: { allowAdsorb?: boolean }) => Promise<void>;
};
/**
@@ -353,7 +353,7 @@
      setTimeout(() => {
        mapCtx.getCenterLocation({
          success: (res) => {
            deps.queryPointerByCenter(res.latitude, res.longitude);
            deps.queryPointerByCenter(res.latitude, res.longitude, { allowAdsorb: false }); // 查看运营区域仅刷新围栏与站点,不吸附最近点位
          }
        });
      }, 600);
src/pages/robotaxi/home/hooks/use-region-change.ts
@@ -52,8 +52,10 @@
  /**
   * 通过中心点主动触发吸附判断。
   * @param options.allowAdsorb 是否允许吸附到最近点位,默认允许;查看运营区域等仅浏览场景需传 false 以保持视野不被吸附打断。
   */
  const queryPointerByCenter = async (lat: number, lng: number) => {
  const queryPointerByCenter = async (lat: number, lng: number, options?: { allowAdsorb?: boolean }) => {
    const allowAdsorb = options?.allowAdsorb !== false;
    siteState.setBounce(true);
    siteState.setShowToolTip(false);
    try {
@@ -68,12 +70,17 @@
        return;
      }
      const nearestCandidates = sites.length > 0 ? sites : newMarkers;
      const { adsorbed, marker } = siteState.tryAdsorb(lat, lng, nearestCandidates);
      const { adsorbed, marker } = allowAdsorb
        ? siteState.tryAdsorb(lat, lng, nearestCandidates)
        : { adsorbed: false, marker: null }; // 仅浏览运营区域时不吸附最近点位
      commitQueriedMarkers(newMarkers, true, adsorbed);
      const finalLat = adsorbed && marker ? marker.latitude : lat; // 最终纬度
      const finalLng = adsorbed && marker ? marker.longitude : lng; // 最终经度
      mapState.setLatitude(finalLat);
      mapState.setLongitude(finalLng);
      if (allowAdsorb) {
        // 仅浏览运营区域时不回写地图中心,避免 Map 组件按旧 scale 重绘导致刚展开的运营区视野被收回
        mapState.setLatitude(finalLat);
        mapState.setLongitude(finalLng);
      }
      settleRegionResult({ lat: finalLat, lon: finalLng, isInside: true });
      setTimeout(async () => {
        siteState.setBounce(false);