Revamp map page layout and compass while removing GPS demo

This commit is contained in:
2026-03-23 12:59:51 +08:00
parent 51740761f5
commit 277121fd51
11 changed files with 1053 additions and 373 deletions

View File

@@ -16,7 +16,11 @@ function buildVectorCamera(scene: MapScene): CameraState {
}
export class GpsLayer implements MapLayer {
projectPoint(scene: MapScene): ScreenPoint {
projectPoint(scene: MapScene): ScreenPoint | null {
if (!scene.gpsPoint) {
return null
}
const camera = buildVectorCamera(scene)
const worldPoint = calibratedLonLatToWorldTile(scene.gpsPoint, scene.zoom, scene.gpsCalibration, scene.gpsCalibrationOrigin)
return worldToScreen(camera, worldPoint, false)
@@ -29,6 +33,10 @@ export class GpsLayer implements MapLayer {
draw(context: LayerRenderContext): void {
const { ctx, scene, pulseFrame } = context
const gpsScreenPoint = this.projectPoint(scene)
if (!gpsScreenPoint) {
return
}
const pulse = this.getPulseRadius(pulseFrame)
ctx.save()