修复导览楼层切换点位错层
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
:key="floor.id"
|
||||
class="floor-item"
|
||||
:class="{ active: activeFloorId === floor.id && layerMode !== 'multi' }"
|
||||
@tap="handleFloorChange(floor.label)"
|
||||
@tap.stop="handleFloorChange(floor)"
|
||||
>
|
||||
<text class="floor-label">{{ floor.label }}</text>
|
||||
</view>
|
||||
@@ -445,6 +445,7 @@ const activeFloorId = computed(() => {
|
||||
return normalizedFloor?.id || normalizedFloorId
|
||||
})
|
||||
const activeFloorScrollIntoView = ref('')
|
||||
let suppressFloorAutoScrollUntil = 0
|
||||
|
||||
const syncActiveFloorScroll = () => {
|
||||
if (props.mapType !== 'indoor' || props.indoorView === 'overview' || props.layerMode === 'multi') {
|
||||
@@ -452,6 +453,11 @@ const syncActiveFloorScroll = () => {
|
||||
return
|
||||
}
|
||||
|
||||
if (Date.now() < suppressFloorAutoScrollUntil) {
|
||||
activeFloorScrollIntoView.value = ''
|
||||
return
|
||||
}
|
||||
|
||||
const matchedFloor = floorItems.value.find((floor) => floor.id === activeFloorId.value)
|
||||
activeFloorScrollIntoView.value = matchedFloor?.scrollId || ''
|
||||
}
|
||||
@@ -517,13 +523,15 @@ const handleModeChange = (mode: '2d' | '3d') => {
|
||||
emit('modeChange', mode)
|
||||
}
|
||||
|
||||
const handleFloorChange = (floor: string) => {
|
||||
const floorId = props.normalizeFloorId(floor)
|
||||
const handleFloorChange = (floor: { id: string; label: string }) => {
|
||||
const floorId = floor.id || props.normalizeFloorId(floor.label)
|
||||
suppressFloorAutoScrollUntil = Date.now() + 650
|
||||
activeFloorScrollIntoView.value = ''
|
||||
indoorRendererRef.value?.disableAutoSwitchTemporarily?.(10000)
|
||||
void indoorRendererRef.value?.switchFloor?.(floorId)
|
||||
emit('indoorViewChange', 'floor')
|
||||
emit('layerModeChange', 'single')
|
||||
emit('floorChange', floor)
|
||||
emit('floorChange', floor.label)
|
||||
}
|
||||
|
||||
const handleLayerModeChange = (mode: LayerDisplayMode) => {
|
||||
|
||||
Reference in New Issue
Block a user