Revamp map page layout and compass while removing GPS demo
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -32,6 +32,9 @@ export class TrackLayer implements MapLayer {
|
||||
draw(context: LayerRenderContext): void {
|
||||
const { ctx, scene } = context
|
||||
const points = this.projectPoints(scene)
|
||||
if (!points.length) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.save()
|
||||
ctx.lineCap = 'round'
|
||||
|
||||
Reference in New Issue
Block a user