Revamp map page layout and compass while removing GPS demo
This commit is contained in:
@@ -47,17 +47,6 @@ const COMPASS_NEEDLE_SMOOTHING = 0.12
|
||||
const GPS_TRACK_MAX_POINTS = 200
|
||||
const GPS_TRACK_MIN_STEP_METERS = 3
|
||||
|
||||
const SAMPLE_TRACK_WGS84: LonLatPoint[] = [
|
||||
worldTileToLonLat({ x: DEFAULT_CENTER_TILE_X - 0.72, y: DEFAULT_CENTER_TILE_Y + 0.44 }, DEFAULT_ZOOM),
|
||||
worldTileToLonLat({ x: DEFAULT_CENTER_TILE_X - 0.18, y: DEFAULT_CENTER_TILE_Y + 0.08 }, DEFAULT_ZOOM),
|
||||
worldTileToLonLat({ x: DEFAULT_CENTER_TILE_X + 0.22, y: DEFAULT_CENTER_TILE_Y - 0.16 }, DEFAULT_ZOOM),
|
||||
worldTileToLonLat({ x: DEFAULT_CENTER_TILE_X + 0.64, y: DEFAULT_CENTER_TILE_Y - 0.52 }, DEFAULT_ZOOM),
|
||||
]
|
||||
const SAMPLE_GPS_WGS84: LonLatPoint = worldTileToLonLat(
|
||||
{ x: DEFAULT_CENTER_TILE_X + 0.12, y: DEFAULT_CENTER_TILE_Y - 0.06 },
|
||||
DEFAULT_ZOOM,
|
||||
)
|
||||
|
||||
type TouchPoint = WechatMiniprogram.TouchDetail
|
||||
|
||||
type GestureMode = 'idle' | 'pan' | 'pinch'
|
||||
@@ -435,7 +424,7 @@ export class MapEngine {
|
||||
defaultCenterTileX: number
|
||||
defaultCenterTileY: number
|
||||
tileBoundsByZoom: Record<number, TileZoomBounds> | null
|
||||
currentGpsPoint: LonLatPoint
|
||||
currentGpsPoint: LonLatPoint | null
|
||||
currentGpsTrack: LonLatPoint[]
|
||||
currentGpsAccuracyMeters: number | null
|
||||
hasGpsCenteredOnce: boolean
|
||||
@@ -485,7 +474,7 @@ export class MapEngine {
|
||||
this.defaultCenterTileX = DEFAULT_CENTER_TILE_X
|
||||
this.defaultCenterTileY = DEFAULT_CENTER_TILE_Y
|
||||
this.tileBoundsByZoom = null
|
||||
this.currentGpsPoint = SAMPLE_GPS_WGS84
|
||||
this.currentGpsPoint = null
|
||||
this.currentGpsTrack = []
|
||||
this.currentGpsAccuracyMeters = null
|
||||
this.hasGpsCenteredOnce = false
|
||||
@@ -1302,13 +1291,12 @@ export class MapEngine {
|
||||
const exactCenter = this.getExactCenterFromTranslate(this.state.tileTranslateX, this.state.tileTranslateY)
|
||||
const resolvedViewport = this.resolveViewportForExactCenter(exactCenter.x, exactCenter.y, nextRotationDeg)
|
||||
|
||||
this.state = {
|
||||
...this.state,
|
||||
this.setState({
|
||||
...resolvedViewport,
|
||||
rotationDeg: nextRotationDeg,
|
||||
rotationText: formatRotationText(nextRotationDeg),
|
||||
centerText: buildCenterText(this.state.zoom, resolvedViewport.centerTileX, resolvedViewport.centerTileY),
|
||||
}
|
||||
})
|
||||
this.syncRenderer()
|
||||
}
|
||||
|
||||
@@ -1408,7 +1396,7 @@ export class MapEngine {
|
||||
previewScale: this.previewScale || 1,
|
||||
previewOriginX: this.previewOriginX || this.state.stageWidth / 2,
|
||||
previewOriginY: this.previewOriginY || this.state.stageHeight / 2,
|
||||
track: this.currentGpsTrack.length ? this.currentGpsTrack : SAMPLE_TRACK_WGS84,
|
||||
track: this.currentGpsTrack,
|
||||
gpsPoint: this.currentGpsPoint,
|
||||
gpsCalibration: GPS_MAP_CALIBRATION,
|
||||
gpsCalibrationOrigin: worldTileToLonLat({ x: this.defaultCenterTileX, y: this.defaultCenterTileY }, this.defaultZoom),
|
||||
@@ -1807,6 +1795,8 @@ export class MapEngine {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user