feat: fix gps map projection and update map config

This commit is contained in:
2026-03-23 10:05:41 +08:00
parent a4c426df8b
commit 51740761f5
11 changed files with 214 additions and 55 deletions

View File

@@ -1,13 +1,16 @@
import { type CameraState } from '../camera/camera'
import { type TileStoreStats } from '../tile/tileStore'
import { type LonLatPoint } from '../../utils/projection'
import { type LonLatPoint, type MapCalibration } from '../../utils/projection'
import { type TileZoomBounds } from '../../utils/remoteMapConfig'
export interface MapScene {
tileSource: string
osmTileSource: string
zoom: number
centerTileX: number
centerTileY: number
exactCenterWorldX: number
exactCenterWorldY: number
tileBoundsByZoom: Record<number, TileZoomBounds> | null
viewportWidth: number
viewportHeight: number
@@ -21,6 +24,10 @@ export interface MapScene {
previewOriginY: number
track: LonLatPoint[]
gpsPoint: LonLatPoint
gpsCalibration: MapCalibration
gpsCalibrationOrigin: LonLatPoint
osmReferenceEnabled: boolean
overlayOpacity: number
}
export type MapRendererStats = TileStoreStats
@@ -34,8 +41,8 @@ export interface MapRenderer {
export function buildCamera(scene: MapScene): CameraState {
return {
centerWorldX: scene.centerTileX,
centerWorldY: scene.centerTileY,
centerWorldX: scene.centerTileX + 0.5,
centerWorldY: scene.centerTileY + 0.5,
viewportWidth: scene.viewportWidth,
viewportHeight: scene.viewportHeight,
visibleColumns: scene.visibleColumns,
@@ -44,5 +51,3 @@ export function buildCamera(scene: MapScene): CameraState {
rotationRad: scene.rotationRad,
}
}