diff --git a/src/components/map/ThreeMap.vue b/src/components/map/ThreeMap.vue index d8e4cfa..6a31520 100644 --- a/src/components/map/ThreeMap.vue +++ b/src/components/map/ThreeMap.vue @@ -833,6 +833,7 @@ const emitFloorChange = (floorId: string, sceneRevision = props.sceneRevision) = } const currentFloor = ref(props.initialFloorId) const selectedPOI = ref(null) +let routeStartSelectionGeneration = 0 const activeFocusPoiId = ref('') const floorIndex = ref([]) const renderPackage = ref(null) @@ -8157,6 +8158,14 @@ const selectRouteStartCandidateNear = ( const handleSceneTap = async (event: PointerEvent) => { if (!camera || !renderer || !getContainerElement()) return + const routeStartSelectionActiveAtTap = props.routeStartSelectionActive + const routeStartSelectionGenerationAtTap = routeStartSelectionGeneration + const canResolveRouteStartForTap = () => ( + routeStartSelectionActiveAtTap + && props.routeStartSelectionActive + && routeStartSelectionGeneration === routeStartSelectionGenerationAtTap + ) + const rect = renderer.domElement.getBoundingClientRect() const pointer = new THREE.Vector2( ((event.clientX - rect.left) / rect.width) * 2 - 1, @@ -8215,7 +8224,8 @@ const handleSceneTap = async (event: PointerEvent) => { } const poi = findLoadedPoi(selectedPoi.id) || selectedPoi - if (props.routeStartSelectionActive) { + if (routeStartSelectionActiveAtTap) { + if (!canResolveRouteStartForTap()) return if (poi.positionGltf) { selectRouteStartCandidateNear( poi.floorId, @@ -8248,7 +8258,8 @@ const handleSceneTap = async (event: PointerEvent) => { : [] const matchedModelPoi = findPoiForModelHits(modelHits) - if (props.routeStartSelectionActive) { + if (routeStartSelectionActiveAtTap) { + if (!canResolveRouteStartForTap()) return if (matchedModelPoi?.poi.positionGltf) { selectRouteStartCandidateNear( matchedModelPoi.poi.floorId, @@ -9426,11 +9437,13 @@ watch(() => props.visiblePoiIds, () => { }) watch(() => props.routeStartSelectionActive, (isSelectingStart) => { + routeStartSelectionGeneration += 1 if (isSelectingStart) { clearMapSelection(false) } }, { - immediate: true + immediate: true, + flush: 'sync' }) watch(() => [props.routePreview, props.showRoute, props.routeNavigationActive], () => { diff --git a/src/components/navigation/RoutePlannerPanel.vue b/src/components/navigation/RoutePlannerPanel.vue index 6efddb2..c39524f 100644 --- a/src/components/navigation/RoutePlannerPanel.vue +++ b/src/components/navigation/RoutePlannerPanel.vue @@ -38,15 +38,15 @@ - + 确认选择 {{ normalizeVisitorPoiDisplayName(startCandidate.name) }} 为起点吗? - + 取消 - + 确定 @@ -56,7 +56,7 @@