完善地图交互、动画与罗盘调试

This commit is contained in:
2026-03-26 16:58:53 +08:00
parent d695308a55
commit 5fc996dea1
18 changed files with 1566 additions and 165 deletions

View File

@@ -0,0 +1,24 @@
export type AnimationLevel = 'standard' | 'lite'
const LITE_BENCHMARK_THRESHOLD = 18
const LITE_DEVICE_MEMORY_GB = 3
export function resolveAnimationLevel(systemInfo?: WechatMiniprogram.SystemInfo): AnimationLevel {
const info = systemInfo || wx.getSystemInfoSync()
const benchmarkLevel = Number((info as WechatMiniprogram.SystemInfo & { benchmarkLevel?: number }).benchmarkLevel)
const deviceMemory = Number((info as WechatMiniprogram.SystemInfo & { deviceMemory?: number }).deviceMemory)
if (Number.isFinite(benchmarkLevel) && benchmarkLevel > 0 && benchmarkLevel <= LITE_BENCHMARK_THRESHOLD) {
return 'lite'
}
if (Number.isFinite(deviceMemory) && deviceMemory > 0 && deviceMemory <= LITE_DEVICE_MEMORY_GB) {
return 'lite'
}
return 'standard'
}
export function formatAnimationLevelText(level: AnimationLevel): string {
return level === 'lite' ? '精简' : '标准'
}