修复首页外观模型首次缩放切换
This commit is contained in:
@@ -2248,6 +2248,19 @@ const zoomCamera = (direction: 'in' | 'out', options: { source?: ZoomCameraSourc
|
|||||||
|
|
||||||
const shouldTrackUserZoom = options.source === 'button'
|
const shouldTrackUserZoom = options.source === 'button'
|
||||||
|
|
||||||
|
if (shouldTrackUserZoom && direction === 'in' && activeView.value === 'overview') {
|
||||||
|
const now = Date.now()
|
||||||
|
if (!isOverviewEntryIntentActive(now)) {
|
||||||
|
overviewEntryIntentStartedAt = now
|
||||||
|
overviewEntryStartDistance = currentDistance
|
||||||
|
overviewEntryZoomInRounds = 0
|
||||||
|
}
|
||||||
|
overviewEntryIntentStartedAt = now
|
||||||
|
overviewEntryZoomInRounds += 1
|
||||||
|
overviewWheelZoomInRounds += 1
|
||||||
|
overviewWheelZoomIntentUntil = now + 900
|
||||||
|
}
|
||||||
|
|
||||||
offset.setLength(nextDistance)
|
offset.setLength(nextDistance)
|
||||||
const nextPosition = controls.target.clone().add(offset)
|
const nextPosition = controls.target.clone().add(offset)
|
||||||
moveCameraTo(nextPosition, controls.target, {
|
moveCameraTo(nextPosition, controls.target, {
|
||||||
@@ -2255,11 +2268,39 @@ const zoomCamera = (direction: 'in' | 'out', options: { source?: ZoomCameraSourc
|
|||||||
})
|
})
|
||||||
if (shouldTrackUserZoom) {
|
if (shouldTrackUserZoom) {
|
||||||
lastControlDistance = currentDistance
|
lastControlDistance = currentDistance
|
||||||
|
checkAutoSwitch({
|
||||||
|
forceOverviewEntry: direction === 'in' && activeView.value === 'overview'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleControlChange()
|
handleControlChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadCurrentFloorPoiMarkers = async (loadToken: number) => {
|
||||||
|
if (!shouldRenderPoiMarkers.value) return
|
||||||
|
|
||||||
|
const floor = floorIndex.value.find((item) => item.floorId === currentFloor.value) || floorIndex.value[0]
|
||||||
|
if (!floor) return
|
||||||
|
|
||||||
|
await loadFloorPOIs(floor, loadToken)
|
||||||
|
assertCurrentModelLoad(loadToken)
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadCurrentFloorPoiMarkersInBackground = (loadToken: number) => {
|
||||||
|
if (!shouldRenderPoiMarkers.value) return
|
||||||
|
|
||||||
|
void loadCurrentFloorPoiMarkers(loadToken)
|
||||||
|
.then(() => {
|
||||||
|
if (!isCurrentModelLoad(loadToken)) return
|
||||||
|
refreshPoiVisibilityByDistance()
|
||||||
|
renderRoutePreview()
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if (isStaleModelLoadError(error)) return
|
||||||
|
console.warn('馆内外观点位标记后台加载失败:', error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const loadOverview = async () => {
|
const loadOverview = async () => {
|
||||||
const packageData = renderPackage.value
|
const packageData = renderPackage.value
|
||||||
if (!packageData || !scene) return
|
if (!packageData || !scene) return
|
||||||
@@ -2278,6 +2319,7 @@ const loadOverview = async () => {
|
|||||||
cacheAutoSwitchOverviewMaxDim(activeModel)
|
cacheAutoSwitchOverviewMaxDim(activeModel)
|
||||||
targetScene.add(activeModel)
|
targetScene.add(activeModel)
|
||||||
fitCameraToObject(activeModel)
|
fitCameraToObject(activeModel)
|
||||||
|
loadCurrentFloorPoiMarkersInBackground(loadToken)
|
||||||
resetAutoSwitchDistanceTracking()
|
resetAutoSwitchDistanceTracking()
|
||||||
refreshPoiVisibilityByDistance()
|
refreshPoiVisibilityByDistance()
|
||||||
renderRoutePreview()
|
renderRoutePreview()
|
||||||
@@ -2304,6 +2346,7 @@ const loadOverview = async () => {
|
|||||||
cachedSharedModelUrl = packageData.overviewModelUrl
|
cachedSharedModelUrl = packageData.overviewModelUrl
|
||||||
targetScene.add(activeModel)
|
targetScene.add(activeModel)
|
||||||
fitCameraToObject(activeModel)
|
fitCameraToObject(activeModel)
|
||||||
|
loadCurrentFloorPoiMarkersInBackground(loadToken)
|
||||||
resetAutoSwitchDistanceTracking()
|
resetAutoSwitchDistanceTracking()
|
||||||
refreshPoiVisibilityByDistance()
|
refreshPoiVisibilityByDistance()
|
||||||
renderRoutePreview()
|
renderRoutePreview()
|
||||||
|
|||||||
Reference in New Issue
Block a user