完善设置面板并整理动画阶段总结
This commit is contained in:
@@ -59,6 +59,7 @@ const AUTO_ROTATE_MAX_STEP_DEG = 0.75
|
||||
const AUTO_ROTATE_HEADING_SMOOTHING = 0.46
|
||||
const COMPASS_NEEDLE_FRAME_MS = 16
|
||||
const COMPASS_NEEDLE_SNAP_DEG = 0.08
|
||||
const COMPASS_BOOTSTRAP_RETRY_DELAY_MS = 700
|
||||
const COMPASS_TUNING_PRESETS: Record<CompassTuningProfile, {
|
||||
needleMinSmoothing: number
|
||||
needleMaxSmoothing: number
|
||||
@@ -830,6 +831,7 @@ export class MapEngine {
|
||||
viewSyncTimer: number
|
||||
autoRotateTimer: number
|
||||
compassNeedleTimer: number
|
||||
compassBootstrapRetryTimer: number
|
||||
pendingViewPatch: Partial<MapEngineViewState>
|
||||
mounted: boolean
|
||||
diagnosticUiEnabled: boolean
|
||||
@@ -838,6 +840,7 @@ export class MapEngine {
|
||||
smoothedSensorHeadingDeg: number | null
|
||||
compassDisplayHeadingDeg: number | null
|
||||
targetCompassDisplayHeadingDeg: number | null
|
||||
lastCompassSampleAt: number
|
||||
compassSource: 'compass' | 'motion' | null
|
||||
compassTuningProfile: CompassTuningProfile
|
||||
smoothedMovementHeadingDeg: number | null
|
||||
@@ -1282,6 +1285,7 @@ export class MapEngine {
|
||||
this.viewSyncTimer = 0
|
||||
this.autoRotateTimer = 0
|
||||
this.compassNeedleTimer = 0
|
||||
this.compassBootstrapRetryTimer = 0
|
||||
this.pendingViewPatch = {}
|
||||
this.mounted = false
|
||||
this.diagnosticUiEnabled = false
|
||||
@@ -1290,6 +1294,7 @@ export class MapEngine {
|
||||
this.smoothedSensorHeadingDeg = null
|
||||
this.compassDisplayHeadingDeg = null
|
||||
this.targetCompassDisplayHeadingDeg = null
|
||||
this.lastCompassSampleAt = 0
|
||||
this.compassSource = null
|
||||
this.compassTuningProfile = 'balanced'
|
||||
this.smoothedMovementHeadingDeg = null
|
||||
@@ -1406,6 +1411,7 @@ export class MapEngine {
|
||||
this.clearViewSyncTimer()
|
||||
this.clearAutoRotateTimer()
|
||||
this.clearCompassNeedleTimer()
|
||||
this.clearCompassBootstrapRetryTimer()
|
||||
this.clearPunchFeedbackTimer()
|
||||
this.clearContentCardTimer()
|
||||
this.clearMapPulseTimer()
|
||||
@@ -1424,6 +1430,11 @@ export class MapEngine {
|
||||
|
||||
handleAppShow(): void {
|
||||
this.feedbackDirector.setAppAudioMode('foreground')
|
||||
if (this.mounted) {
|
||||
this.lastCompassSampleAt = 0
|
||||
this.compassController.start()
|
||||
this.scheduleCompassBootstrapRetry()
|
||||
}
|
||||
}
|
||||
|
||||
handleAppHide(): void {
|
||||
@@ -2351,7 +2362,9 @@ export class MapEngine {
|
||||
})
|
||||
this.syncRenderer()
|
||||
this.accelerometerErrorText = null
|
||||
this.lastCompassSampleAt = 0
|
||||
this.compassController.start()
|
||||
this.scheduleCompassBootstrapRetry()
|
||||
this.gyroscopeController.start()
|
||||
this.deviceMotionController.start()
|
||||
}
|
||||
@@ -2980,6 +2993,8 @@ export class MapEngine {
|
||||
}
|
||||
|
||||
handleCompassHeading(headingDeg: number): void {
|
||||
this.lastCompassSampleAt = Date.now()
|
||||
this.clearCompassBootstrapRetryTimer()
|
||||
this.applyHeadingSample(headingDeg, 'compass')
|
||||
}
|
||||
|
||||
@@ -3584,6 +3599,29 @@ export class MapEngine {
|
||||
}
|
||||
}
|
||||
|
||||
clearCompassBootstrapRetryTimer(): void {
|
||||
if (this.compassBootstrapRetryTimer) {
|
||||
clearTimeout(this.compassBootstrapRetryTimer)
|
||||
this.compassBootstrapRetryTimer = 0
|
||||
}
|
||||
}
|
||||
|
||||
scheduleCompassBootstrapRetry(): void {
|
||||
this.clearCompassBootstrapRetryTimer()
|
||||
if (!this.mounted) {
|
||||
return
|
||||
}
|
||||
|
||||
this.compassBootstrapRetryTimer = setTimeout(() => {
|
||||
this.compassBootstrapRetryTimer = 0
|
||||
if (!this.mounted || this.lastCompassSampleAt > 0) {
|
||||
return
|
||||
}
|
||||
this.compassController.stop()
|
||||
this.compassController.start()
|
||||
}, COMPASS_BOOTSTRAP_RETRY_DELAY_MS) as unknown as number
|
||||
}
|
||||
|
||||
syncCompassDisplayState(): void {
|
||||
this.setState({
|
||||
compassNeedleDeg: formatCompassNeedleDegForMode(this.northReferenceMode, this.compassDisplayHeadingDeg),
|
||||
|
||||
Reference in New Issue
Block a user