董国庆
2026-07-20 88c81b1e706b2485aac47f8a163ea9c3beae934e
通过判断机型,优化路线和车辆mark的显示不连贯,中间有空隙的问题。
6个文件已修改
68 ■■■■■ 已修改文件
src/robotaxi/pages/begin-route/hooks/use-polyline-render.ts 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-smooth-route-motion.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/index.tsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/share-trip/hooks/use-polyline-render.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/share-trip/hooks/use-smooth-route-motion.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/share-trip/index.tsx 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/hooks/use-polyline-render.ts
@@ -235,21 +235,27 @@
    }
    const executeRouteErase = () => {
      if (bestMatchIndex >= startIndex && bestDistance < ROUTE_ERASE_MAX_DISTANCE_METERS) {
        Taro.createMapContext('map').eraseLines({
          lines: [{
            id: ROUTE_POLYLINE_BASE_ID,
            index: Math.max(0, bestMatchIndex - 1),
            point: {
              latitude: boundaryPoint.latitude,
              longitude: boundaryPoint.longitude,
            },
            clear: true
          }]
        });
      }
      applyErasedRoutePoints(newPoints);
    };
        if (bestMatchIndex >= startIndex && bestDistance < ROUTE_ERASE_MAX_DISTANCE_METERS) {
          // [BugFix] 获取当前真实激活的主路线 ID,防止多路线(修改目的地)态下擦线 ID 不匹配导致静默失效
          const activePolylineId = deps.shouldShowRoute && deps.allowSelectableRoutes && allRoutePoints.length > 1
            ? ROUTE_POLYLINE_BASE_ID + selectedRouteIndex
            : ROUTE_POLYLINE_BASE_ID;
          Taro.createMapContext('map').eraseLines({
            lines: [{
              id: activePolylineId,
              // [BugFix] 修复 Android 端 eraseLines Bug: Android 有时会连带 point 所在的整段 index 全部擦除导致视觉断层。
              // 针对 Android 平台强制 index 减 1,做保守补偿擦除,使车辆能完美贴合断点。
              index: deps.isAndroid ? Math.max(0, bestMatchIndex - 1) : bestMatchIndex,
              point: {
                latitude: boundaryPoint.latitude,
                longitude: boundaryPoint.longitude,
              },
              clear: true
            }]
          });
        }
        applyErasedRoutePoints(newPoints);
      };
    if (process.env.TARO_ENV !== 'weapp' || routeEraseReadyRef.current) {
      executeRouteErase();
src/robotaxi/pages/begin-route/hooks/use-smooth-route-motion.ts
@@ -38,6 +38,10 @@
  updateVehicleLocationThrottled: (lat: number, lng: number, force?: boolean) => void;
  /** 读取用户手势是否进行中(拖拽/缩放手势 begin→end 之间为 true)。 */
  getUserGestureActive?: () => boolean;
  /** 是否为安卓设备 */
  isAndroid: boolean;
  /** 当前激活的主路线折线 ID */
  activePolylineId: number;
};
type MotionRuntimeState = {
@@ -74,7 +78,6 @@
  PROJECT_SOFT_THRESHOLD_METERS = 25,
}
const ROUTE_POLYLINE_ID = 2001; // 主路线折线 id
const FIRST_ROUTE_ERASE_READY_DELAY_MS = 120;
export default function useSmoothRouteMotion(deps: Deps) {
@@ -118,8 +121,10 @@
    const { index, point } = getRouteCursorByDistance(routeIndex, nextDistance);
    Taro.createMapContext('map').eraseLines({
      lines: [{
        id: ROUTE_POLYLINE_ID,
        index,
        id: deps.activePolylineId,
        // [BugFix] 修复 Android 端 eraseLines Bug: Android 有时会连带 point 所在的整段 index 全部擦除导致车辆和路线之间出现“空距离”的视觉断层。
        // 针对 Android 平台强制 index 减 1 做保守补偿擦除。
        index: deps.isAndroid ? Math.max(0, index - 1) : index,
        point,
        clear: true,
      }]
src/robotaxi/pages/begin-route/index.tsx
@@ -27,6 +27,7 @@
import useAndroidOverlays from './hooks/use-android-overlays';
import useRouteSummaryAnchorLocation from './hooks/use-route-summary-anchor-location';
// 地图视口状态管理
import { ROUTE_POLYLINE_BASE_ID } from './hooks/use-route-manager.shared';
import useMapViewport from './hooks/use-map-viewport';
import useActiveTripScale from './hooks/use-active-trip-scale';
// 速度驱动的地图自动缩放
@@ -1331,7 +1332,11 @@
    setVehicleDirection,
    setVehicleMoveAlongPoints,
    updateVehicleLocationThrottled: vehicleState.updateVehicleLocationThrottled,
    getUserGestureActive: () => userGestureActiveRef.current
    getUserGestureActive: () => userGestureActiveRef.current,
    isAndroid,
    activePolylineId: allowSelectableRoutes && routeState.allRoutePoints.length > 1
      ? ROUTE_POLYLINE_BASE_ID + routeState.selectedRouteIndex
      : ROUTE_POLYLINE_BASE_ID
  });
  useEffect(() => {
src/robotaxi/pages/share-trip/hooks/use-polyline-render.ts
@@ -182,7 +182,9 @@
                Taro.createMapContext('map').eraseLines({
                    lines: [{
                        id: ROUTE_POLYLINE_BASE_ID,
                        index: Math.max(0, bestMatchIndex - 1),
                        // [BugFix] 修复 Android 端 eraseLines Bug: Android 有时会连带 point 所在的整段 index 全部擦除导致视觉断层。
                        // 针对 Android 平台强制 index 减 1,做保守补偿擦除,使车辆能完美贴合断点。
                        index: deps.isAndroid ? Math.max(0, bestMatchIndex - 1) : bestMatchIndex,
                        point: {
                            latitude: boundaryPoint.latitude,
                            longitude: boundaryPoint.longitude
src/robotaxi/pages/share-trip/hooks/use-smooth-route-motion.ts
@@ -14,6 +14,7 @@
    toMeters,
    type RouteIndex,
} from './trip-motion-utils';
import { ROUTE_POLYLINE_BASE_ID } from './use-route-manager.shared';
type Deps = {
    tripStatus: number;
@@ -26,6 +27,7 @@
    setVehicleDirection: (value: number) => void;
    setVehicleMoveAlongPoints: (points: RoutePoint[]) => void;
    updateVehicleLocationThrottled: (lat: number, lng: number, force?: boolean) => void;
    isAndroid: boolean;
};
type MotionRuntimeState = {
@@ -50,7 +52,6 @@
    REBASE_ROUTE_DEVIATION_METERS = 30,
}
const ROUTE_POLYLINE_ID = 2001;
const FIRST_ROUTE_ERASE_READY_DELAY_MS = 120;
export default function useSmoothRouteMotion(deps: Deps) {
@@ -87,8 +88,10 @@
        const { index, point } = getRouteCursorByDistance(routeIndex, nextDistance);
        Taro.createMapContext('map').eraseLines({
            lines: [{
                id: ROUTE_POLYLINE_ID,
                index,
                id: ROUTE_POLYLINE_BASE_ID,
                // [BugFix] 修复 Android 端 eraseLines Bug: Android 有时会连带 point 所在的整段 index 全部擦除导致车辆和路线之间出现“空距离”的视觉断层。
                // 针对 Android 平台强制 index 减 1 做保守补偿擦除。
                index: deps.isAndroid ? Math.max(0, index - 1) : index,
                point,
                clear: true,
            }]
src/robotaxi/pages/share-trip/index.tsx
@@ -209,6 +209,7 @@
    setVehicleDirection,
    setVehicleMoveAlongPoints,
    updateVehicleLocationThrottled,
    isAndroid,
  });
  const {