fix: 统一馆内三维模型返回初始状态
This commit is contained in:
@@ -29,6 +29,8 @@ interface VisualReport {
|
||||
anchors: AnchorReport[]
|
||||
activeView: string
|
||||
floorId: string
|
||||
activeFocusPoiId: string
|
||||
hasPendingTargetFocus: boolean
|
||||
isCameraTweening: boolean
|
||||
poiFocusCameraAnimationCount: number
|
||||
cameraSnapshotRestoreCount: number
|
||||
@@ -58,6 +60,7 @@ interface VisualStabilityApi {
|
||||
getFloors: () => FloorReport[]
|
||||
switchFloor: (floorId: string) => Promise<void>
|
||||
showOverview: () => Promise<void>
|
||||
resetToInitialState: () => Promise<boolean>
|
||||
getFloorPois: (floorId: string) => Promise<PoiFocusCandidate[]>
|
||||
focusTargetPoi: (request: {
|
||||
requestId: number | string
|
||||
@@ -399,3 +402,33 @@ test('queued cross-floor search POI focus keeps raw GLB_METER coordinates and do
|
||||
await switchFloor(page, testInfo, l1, 'search-focus-clear-lminus1-l1')
|
||||
await showOverview(page, testInfo, 'search-focus-clear-l1-exterior')
|
||||
})
|
||||
|
||||
test('reset invalidates an in-flight cross-floor focus before it can overwrite the initial state', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await Promise.all([
|
||||
page.waitForURL(/tab=guide/, { timeout: 30_000 }),
|
||||
page.getByText('馆内', { exact: true }).click()
|
||||
])
|
||||
await expect.poll(async () => (await getApiState(page)) !== null, { timeout: 180_000 }).toBe(true)
|
||||
await expect.poll(async () => (await getApiState(page))?.floors.length ?? 0, { timeout: 180_000 }).toBeGreaterThan(0)
|
||||
const state = await getApiState(page)
|
||||
expect(state).not.toBeNull()
|
||||
const targetFloor = state!.floors.find((floor) => floor.floorId !== state!.report.floorId)?.floorId
|
||||
|| state!.floors[0]!.floorId
|
||||
const targetPoi = (await getFloorPois(page, targetFloor))[0]!
|
||||
|
||||
await page.evaluate(async (request) => {
|
||||
const api = (window as Window & { __GUIDE_3D_VISUAL_STABILITY__?: VisualStabilityApi })
|
||||
.__GUIDE_3D_VISUAL_STABILITY__
|
||||
if (!api) throw new Error('ThreeMap visual stability diagnostics unavailable')
|
||||
const focus = api.focusTargetPoi({ requestId: 'reset-race', ...request })
|
||||
await api.resetToInitialState()
|
||||
await focus
|
||||
}, targetPoi)
|
||||
|
||||
const report = await getReport(page)
|
||||
expect(report.activeView).toBe('overview')
|
||||
expect(report.activeFocusPoiId).toBe('')
|
||||
expect(report.hasPendingTargetFocus).toBe(false)
|
||||
expect(report.focus).toBeNull()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user