完善样式系统与调试链路底座
This commit is contained in:
@@ -9,6 +9,8 @@ import {
|
||||
import { loadRemoteMapConfig } from '../../utils/remoteMapConfig'
|
||||
import { type AnimationLevel } from '../../utils/animationLevel'
|
||||
import { type H5ExperienceFallbackPayload, type H5ExperienceRequest } from '../../game/experience/h5Experience'
|
||||
import { type TrackColorPreset, type TrackDisplayMode, type TrackStyleProfile, type TrackTailLengthPreset } from '../../game/presentation/trackStyleConfig'
|
||||
import { type GpsMarkerColorPreset, type GpsMarkerSizePreset, type GpsMarkerStyleId } from '../../game/presentation/gpsMarkerStyleConfig'
|
||||
type CompassTickData = {
|
||||
angle: number
|
||||
long: boolean
|
||||
@@ -39,6 +41,14 @@ type UserNorthReferenceMode = 'magnetic' | 'true'
|
||||
type CompassTuningProfile = 'smooth' | 'balanced' | 'responsive'
|
||||
type SettingLockKey =
|
||||
| 'lockAnimationLevel'
|
||||
| 'lockTrackMode'
|
||||
| 'lockTrackTailLength'
|
||||
| 'lockTrackColor'
|
||||
| 'lockTrackStyle'
|
||||
| 'lockGpsMarkerVisible'
|
||||
| 'lockGpsMarkerStyle'
|
||||
| 'lockGpsMarkerSize'
|
||||
| 'lockGpsMarkerColor'
|
||||
| 'lockSideButtonPlacement'
|
||||
| 'lockAutoRotate'
|
||||
| 'lockCompassTuning'
|
||||
@@ -48,6 +58,14 @@ type SettingLockKey =
|
||||
| 'lockHeartRateDevice'
|
||||
type StoredUserSettings = {
|
||||
animationLevel?: AnimationLevel
|
||||
trackDisplayMode?: TrackDisplayMode
|
||||
trackTailLength?: TrackTailLengthPreset
|
||||
trackColorPreset?: TrackColorPreset
|
||||
trackStyleProfile?: TrackStyleProfile
|
||||
gpsMarkerVisible?: boolean
|
||||
gpsMarkerStyle?: GpsMarkerStyleId
|
||||
gpsMarkerSize?: GpsMarkerSizePreset
|
||||
gpsMarkerColorPreset?: GpsMarkerColorPreset
|
||||
autoRotateEnabled?: boolean
|
||||
compassTuningProfile?: CompassTuningProfile
|
||||
northReferenceMode?: UserNorthReferenceMode
|
||||
@@ -55,6 +73,14 @@ type StoredUserSettings = {
|
||||
showCenterScaleRuler?: boolean
|
||||
centerScaleRulerAnchorMode?: CenterScaleRulerAnchorMode
|
||||
lockAnimationLevel?: boolean
|
||||
lockTrackMode?: boolean
|
||||
lockTrackTailLength?: boolean
|
||||
lockTrackColor?: boolean
|
||||
lockTrackStyle?: boolean
|
||||
lockGpsMarkerVisible?: boolean
|
||||
lockGpsMarkerStyle?: boolean
|
||||
lockGpsMarkerSize?: boolean
|
||||
lockGpsMarkerColor?: boolean
|
||||
lockSideButtonPlacement?: boolean
|
||||
lockAutoRotate?: boolean
|
||||
lockCompassTuning?: boolean
|
||||
@@ -77,6 +103,7 @@ type MapPageData = MapEngineViewState & {
|
||||
configSourceText: string
|
||||
mockBridgeUrlDraft: string
|
||||
mockHeartRateBridgeUrlDraft: string
|
||||
mockDebugLogBridgeUrlDraft: string
|
||||
gameInfoTitle: string
|
||||
gameInfoSubtitle: string
|
||||
gameInfoLocalRows: MapEngineGameInfoRow[]
|
||||
@@ -101,6 +128,14 @@ type MapPageData = MapEngineViewState & {
|
||||
sideButtonPlacement: SideButtonPlacement
|
||||
autoRotateEnabled: boolean
|
||||
lockAnimationLevel: boolean
|
||||
lockTrackMode: boolean
|
||||
lockTrackTailLength: boolean
|
||||
lockTrackColor: boolean
|
||||
lockTrackStyle: boolean
|
||||
lockGpsMarkerVisible: boolean
|
||||
lockGpsMarkerStyle: boolean
|
||||
lockGpsMarkerSize: boolean
|
||||
lockGpsMarkerColor: boolean
|
||||
lockSideButtonPlacement: boolean
|
||||
lockAutoRotate: boolean
|
||||
lockCompassTuning: boolean
|
||||
@@ -129,7 +164,7 @@ type MapPageData = MapEngineViewState & {
|
||||
showRightButtonGroups: boolean
|
||||
showBottomDebugButton: boolean
|
||||
}
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-291'
|
||||
const INTERNAL_BUILD_VERSION = 'map-build-293'
|
||||
const USER_SETTINGS_STORAGE_KEY = 'cmr_user_settings_v1'
|
||||
const CLASSIC_REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/gotomars/event/classic-sequential.json'
|
||||
const SCORE_O_REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/gotomars/event/score-o.json'
|
||||
@@ -138,6 +173,8 @@ let mapEngine: MapEngine | null = null
|
||||
let stageCanvasAttached = false
|
||||
let gameInfoPanelSyncTimer = 0
|
||||
let centerScaleRulerSyncTimer = 0
|
||||
let contentAudioRecorder: WechatMiniprogram.RecorderManager | null = null
|
||||
let contentAudioRecording = false
|
||||
let centerScaleRulerUpdateTimer = 0
|
||||
let punchHintDismissTimer = 0
|
||||
let panelTimerFxTimer = 0
|
||||
@@ -371,6 +408,53 @@ function loadStoredUserSettings(): StoredUserSettings {
|
||||
if (normalized.animationLevel === 'standard' || normalized.animationLevel === 'lite') {
|
||||
settings.animationLevel = normalized.animationLevel
|
||||
}
|
||||
if (normalized.trackDisplayMode === 'none' || normalized.trackDisplayMode === 'full' || normalized.trackDisplayMode === 'tail') {
|
||||
settings.trackDisplayMode = normalized.trackDisplayMode
|
||||
}
|
||||
if (normalized.trackTailLength === 'short' || normalized.trackTailLength === 'medium' || normalized.trackTailLength === 'long') {
|
||||
settings.trackTailLength = normalized.trackTailLength
|
||||
}
|
||||
if (normalized.trackStyleProfile === 'classic' || normalized.trackStyleProfile === 'neon') {
|
||||
settings.trackStyleProfile = normalized.trackStyleProfile
|
||||
}
|
||||
if (typeof normalized.gpsMarkerVisible === 'boolean') {
|
||||
settings.gpsMarkerVisible = normalized.gpsMarkerVisible
|
||||
}
|
||||
if (
|
||||
normalized.gpsMarkerStyle === 'dot'
|
||||
|| normalized.gpsMarkerStyle === 'beacon'
|
||||
|| normalized.gpsMarkerStyle === 'disc'
|
||||
|| normalized.gpsMarkerStyle === 'badge'
|
||||
) {
|
||||
settings.gpsMarkerStyle = normalized.gpsMarkerStyle
|
||||
}
|
||||
if (normalized.gpsMarkerSize === 'small' || normalized.gpsMarkerSize === 'medium' || normalized.gpsMarkerSize === 'large') {
|
||||
settings.gpsMarkerSize = normalized.gpsMarkerSize
|
||||
}
|
||||
if (
|
||||
normalized.gpsMarkerColorPreset === 'mint'
|
||||
|| normalized.gpsMarkerColorPreset === 'cyan'
|
||||
|| normalized.gpsMarkerColorPreset === 'sky'
|
||||
|| normalized.gpsMarkerColorPreset === 'blue'
|
||||
|| normalized.gpsMarkerColorPreset === 'violet'
|
||||
|| normalized.gpsMarkerColorPreset === 'pink'
|
||||
|| normalized.gpsMarkerColorPreset === 'orange'
|
||||
|| normalized.gpsMarkerColorPreset === 'yellow'
|
||||
) {
|
||||
settings.gpsMarkerColorPreset = normalized.gpsMarkerColorPreset
|
||||
}
|
||||
if (
|
||||
normalized.trackColorPreset === 'mint'
|
||||
|| normalized.trackColorPreset === 'cyan'
|
||||
|| normalized.trackColorPreset === 'sky'
|
||||
|| normalized.trackColorPreset === 'blue'
|
||||
|| normalized.trackColorPreset === 'violet'
|
||||
|| normalized.trackColorPreset === 'pink'
|
||||
|| normalized.trackColorPreset === 'orange'
|
||||
|| normalized.trackColorPreset === 'yellow'
|
||||
) {
|
||||
settings.trackColorPreset = normalized.trackColorPreset
|
||||
}
|
||||
if (normalized.northReferenceMode === 'magnetic' || normalized.northReferenceMode === 'true') {
|
||||
settings.northReferenceMode = normalized.northReferenceMode
|
||||
}
|
||||
@@ -392,6 +476,30 @@ function loadStoredUserSettings(): StoredUserSettings {
|
||||
if (typeof normalized.lockAnimationLevel === 'boolean') {
|
||||
settings.lockAnimationLevel = normalized.lockAnimationLevel
|
||||
}
|
||||
if (typeof normalized.lockTrackMode === 'boolean') {
|
||||
settings.lockTrackMode = normalized.lockTrackMode
|
||||
}
|
||||
if (typeof normalized.lockTrackTailLength === 'boolean') {
|
||||
settings.lockTrackTailLength = normalized.lockTrackTailLength
|
||||
}
|
||||
if (typeof normalized.lockTrackColor === 'boolean') {
|
||||
settings.lockTrackColor = normalized.lockTrackColor
|
||||
}
|
||||
if (typeof normalized.lockTrackStyle === 'boolean') {
|
||||
settings.lockTrackStyle = normalized.lockTrackStyle
|
||||
}
|
||||
if (typeof normalized.lockGpsMarkerVisible === 'boolean') {
|
||||
settings.lockGpsMarkerVisible = normalized.lockGpsMarkerVisible
|
||||
}
|
||||
if (typeof normalized.lockGpsMarkerStyle === 'boolean') {
|
||||
settings.lockGpsMarkerStyle = normalized.lockGpsMarkerStyle
|
||||
}
|
||||
if (typeof normalized.lockGpsMarkerSize === 'boolean') {
|
||||
settings.lockGpsMarkerSize = normalized.lockGpsMarkerSize
|
||||
}
|
||||
if (typeof normalized.lockGpsMarkerColor === 'boolean') {
|
||||
settings.lockGpsMarkerColor = normalized.lockGpsMarkerColor
|
||||
}
|
||||
if (typeof normalized.lockSideButtonPlacement === 'boolean') {
|
||||
settings.lockSideButtonPlacement = normalized.lockSideButtonPlacement
|
||||
}
|
||||
@@ -722,6 +830,14 @@ Page({
|
||||
centerScaleRulerAnchorMode: 'screen-center',
|
||||
autoRotateEnabled: false,
|
||||
lockAnimationLevel: false,
|
||||
lockTrackMode: false,
|
||||
lockTrackTailLength: false,
|
||||
lockTrackColor: false,
|
||||
lockTrackStyle: false,
|
||||
lockGpsMarkerVisible: false,
|
||||
lockGpsMarkerStyle: false,
|
||||
lockGpsMarkerSize: false,
|
||||
lockGpsMarkerColor: false,
|
||||
lockSideButtonPlacement: false,
|
||||
lockAutoRotate: false,
|
||||
lockCompassTuning: false,
|
||||
@@ -763,13 +879,27 @@ Page({
|
||||
heartRateSourceText: '真实心率',
|
||||
mockHeartRateBridgeConnected: false,
|
||||
mockHeartRateBridgeStatusText: '未连接',
|
||||
mockHeartRateBridgeUrlText: 'wss://gs.gotomars.xyz/mock-gps',
|
||||
mockHeartRateBridgeUrlDraft: 'wss://gs.gotomars.xyz/mock-gps',
|
||||
mockHeartRateBridgeUrlText: 'wss://gs.gotomars.xyz/mock-hr',
|
||||
mockHeartRateBridgeUrlDraft: 'wss://gs.gotomars.xyz/mock-hr',
|
||||
mockHeartRateText: '--',
|
||||
mockDebugLogBridgeConnected: false,
|
||||
mockDebugLogBridgeStatusText: '已关闭 (wss://gs.gotomars.xyz/debug-log)',
|
||||
mockDebugLogBridgeUrlText: 'wss://gs.gotomars.xyz/debug-log',
|
||||
mockDebugLogBridgeUrlDraft: 'wss://gs.gotomars.xyz/debug-log',
|
||||
heartRateScanText: '未扫描',
|
||||
heartRateDiscoveredDevices: [],
|
||||
panelSpeedValueText: '0',
|
||||
panelTelemetryTone: 'blue',
|
||||
trackDisplayMode: 'full',
|
||||
trackTailLength: 'medium',
|
||||
trackColorPreset: 'mint',
|
||||
trackStyleProfile: 'neon',
|
||||
gpsMarkerVisible: true,
|
||||
gpsMarkerStyle: 'beacon',
|
||||
gpsMarkerSize: 'medium',
|
||||
gpsMarkerColorPreset: 'cyan',
|
||||
gpsLogoStatusText: '未配置',
|
||||
gpsLogoSourceText: '--',
|
||||
panelHeartRateZoneNameText: '--',
|
||||
panelHeartRateZoneRangeText: '',
|
||||
heartRateConnected: false,
|
||||
@@ -803,8 +933,14 @@ Page({
|
||||
contentCardTemplate: 'story',
|
||||
contentCardTitle: '',
|
||||
contentCardBody: '',
|
||||
contentCardActionVisible: false,
|
||||
contentCardActionText: '查看详情',
|
||||
contentCardActions: [],
|
||||
contentQuizVisible: false,
|
||||
contentQuizQuestionText: '',
|
||||
contentQuizCountdownText: '',
|
||||
contentQuizOptions: [],
|
||||
contentQuizFeedbackVisible: false,
|
||||
contentQuizFeedbackText: '',
|
||||
contentQuizFeedbackTone: 'neutral',
|
||||
punchButtonFxClass: '',
|
||||
panelProgressFxClass: '',
|
||||
panelDistanceFxClass: '',
|
||||
@@ -875,6 +1011,13 @@ Page({
|
||||
nextData.mockHeartRateBridgeUrlDraft = nextPatch.mockHeartRateBridgeUrlText
|
||||
}
|
||||
|
||||
if (
|
||||
typeof nextPatch.mockDebugLogBridgeUrlText === 'string'
|
||||
&& this.data.mockDebugLogBridgeUrlDraft === this.data.mockDebugLogBridgeUrlText
|
||||
) {
|
||||
nextData.mockDebugLogBridgeUrlDraft = nextPatch.mockDebugLogBridgeUrlText
|
||||
}
|
||||
|
||||
updateCenterScaleRulerInputCache(nextPatch)
|
||||
|
||||
const mergedData = {
|
||||
@@ -1005,6 +1148,30 @@ Page({
|
||||
if (storedUserSettings.animationLevel) {
|
||||
mapEngine.handleSetAnimationLevel(storedUserSettings.animationLevel)
|
||||
}
|
||||
if (storedUserSettings.trackDisplayMode) {
|
||||
mapEngine.handleSetTrackMode(storedUserSettings.trackDisplayMode)
|
||||
}
|
||||
if (storedUserSettings.trackTailLength) {
|
||||
mapEngine.handleSetTrackTailLength(storedUserSettings.trackTailLength)
|
||||
}
|
||||
if (storedUserSettings.trackColorPreset) {
|
||||
mapEngine.handleSetTrackColorPreset(storedUserSettings.trackColorPreset)
|
||||
}
|
||||
if (storedUserSettings.trackStyleProfile) {
|
||||
mapEngine.handleSetTrackStyleProfile(storedUserSettings.trackStyleProfile)
|
||||
}
|
||||
if (typeof storedUserSettings.gpsMarkerVisible === 'boolean') {
|
||||
mapEngine.handleSetGpsMarkerVisible(storedUserSettings.gpsMarkerVisible)
|
||||
}
|
||||
if (storedUserSettings.gpsMarkerStyle) {
|
||||
mapEngine.handleSetGpsMarkerStyle(storedUserSettings.gpsMarkerStyle)
|
||||
}
|
||||
if (storedUserSettings.gpsMarkerSize) {
|
||||
mapEngine.handleSetGpsMarkerSize(storedUserSettings.gpsMarkerSize)
|
||||
}
|
||||
if (storedUserSettings.gpsMarkerColorPreset) {
|
||||
mapEngine.handleSetGpsMarkerColorPreset(storedUserSettings.gpsMarkerColorPreset)
|
||||
}
|
||||
const initialAutoRotateEnabled = storedUserSettings.autoRotateEnabled !== false
|
||||
if (initialAutoRotateEnabled) {
|
||||
mapEngine.handleSetHeadingUpMode()
|
||||
@@ -1045,6 +1212,14 @@ Page({
|
||||
centerScaleRulerAnchorMode: initialCenterScaleRulerAnchorMode,
|
||||
autoRotateEnabled: initialAutoRotateEnabled,
|
||||
lockAnimationLevel: !!storedUserSettings.lockAnimationLevel,
|
||||
lockTrackMode: !!storedUserSettings.lockTrackMode,
|
||||
lockTrackTailLength: !!storedUserSettings.lockTrackTailLength,
|
||||
lockTrackColor: !!storedUserSettings.lockTrackColor,
|
||||
lockTrackStyle: !!storedUserSettings.lockTrackStyle,
|
||||
lockGpsMarkerVisible: !!storedUserSettings.lockGpsMarkerVisible,
|
||||
lockGpsMarkerStyle: !!storedUserSettings.lockGpsMarkerStyle,
|
||||
lockGpsMarkerSize: !!storedUserSettings.lockGpsMarkerSize,
|
||||
lockGpsMarkerColor: !!storedUserSettings.lockGpsMarkerColor,
|
||||
lockSideButtonPlacement: !!storedUserSettings.lockSideButtonPlacement,
|
||||
lockAutoRotate: !!storedUserSettings.lockAutoRotate,
|
||||
lockCompassTuning: !!storedUserSettings.lockCompassTuning,
|
||||
@@ -1083,12 +1258,18 @@ Page({
|
||||
heartRateSourceText: '真实心率',
|
||||
mockHeartRateBridgeConnected: false,
|
||||
mockHeartRateBridgeStatusText: '未连接',
|
||||
mockHeartRateBridgeUrlText: 'wss://gs.gotomars.xyz/mock-gps',
|
||||
mockHeartRateBridgeUrlDraft: 'wss://gs.gotomars.xyz/mock-gps',
|
||||
mockHeartRateBridgeUrlText: 'wss://gs.gotomars.xyz/mock-hr',
|
||||
mockHeartRateBridgeUrlDraft: 'wss://gs.gotomars.xyz/mock-hr',
|
||||
mockHeartRateText: '--',
|
||||
mockDebugLogBridgeConnected: false,
|
||||
mockDebugLogBridgeStatusText: '已关闭 (wss://gs.gotomars.xyz/debug-log)',
|
||||
mockDebugLogBridgeUrlText: 'wss://gs.gotomars.xyz/debug-log',
|
||||
mockDebugLogBridgeUrlDraft: 'wss://gs.gotomars.xyz/debug-log',
|
||||
panelSpeedValueText: '0',
|
||||
panelSpeedFxClass: '',
|
||||
panelTelemetryTone: 'blue',
|
||||
gpsLogoStatusText: '未配置',
|
||||
gpsLogoSourceText: '--',
|
||||
panelHeartRateZoneNameText: '--',
|
||||
panelHeartRateZoneRangeText: '',
|
||||
heartRateConnected: false,
|
||||
@@ -1123,8 +1304,14 @@ Page({
|
||||
contentCardTemplate: 'story',
|
||||
contentCardTitle: '',
|
||||
contentCardBody: '',
|
||||
contentCardActionVisible: false,
|
||||
contentCardActionText: '查看详情',
|
||||
contentCardActions: [],
|
||||
contentQuizVisible: false,
|
||||
contentQuizQuestionText: '',
|
||||
contentQuizCountdownText: '',
|
||||
contentQuizOptions: [],
|
||||
contentQuizFeedbackVisible: false,
|
||||
contentQuizFeedbackText: '',
|
||||
contentQuizFeedbackTone: 'neutral',
|
||||
punchButtonFxClass: '',
|
||||
panelProgressFxClass: '',
|
||||
panelDistanceFxClass: '',
|
||||
@@ -1394,10 +1581,14 @@ Page({
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetMockLocationBridgeUrl(this.data.mockBridgeUrlDraft)
|
||||
mapEngine.handleSetMockHeartRateBridgeUrl(this.data.mockHeartRateBridgeUrlDraft)
|
||||
mapEngine.handleSetMockDebugLogBridgeUrl(this.data.mockDebugLogBridgeUrlDraft)
|
||||
mapEngine.handleConnectMockLocationBridge()
|
||||
mapEngine.handleSetMockLocationMode()
|
||||
mapEngine.handleSetMockHeartRateMode()
|
||||
mapEngine.handleConnectMockHeartRateBridge()
|
||||
mapEngine.handleConnectMockDebugLogBridge()
|
||||
},
|
||||
|
||||
handleOpenWebViewTest() {
|
||||
@@ -1448,6 +1639,30 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
handleMockDebugLogBridgeUrlInput(event: WechatMiniprogram.Input) {
|
||||
this.setData({
|
||||
mockDebugLogBridgeUrlDraft: event.detail.value,
|
||||
})
|
||||
},
|
||||
|
||||
handleSaveMockDebugLogBridgeUrl() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleSetMockDebugLogBridgeUrl(this.data.mockDebugLogBridgeUrlDraft)
|
||||
}
|
||||
},
|
||||
|
||||
handleConnectMockDebugLogBridge() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleConnectMockDebugLogBridge()
|
||||
}
|
||||
},
|
||||
|
||||
handleDisconnectMockDebugLogBridge() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleDisconnectMockDebugLogBridge()
|
||||
}
|
||||
},
|
||||
|
||||
handleConnectMockHeartRateBridge() {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleConnectMockHeartRateBridge()
|
||||
@@ -1776,6 +1991,223 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackModeNone() {
|
||||
if (this.data.lockTrackMode || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackMode('none')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackDisplayMode: 'none',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackModeTail() {
|
||||
if (this.data.lockTrackMode || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackMode('tail')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackDisplayMode: 'tail',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackModeFull() {
|
||||
if (this.data.lockTrackMode || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackMode('full')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackDisplayMode: 'full',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackTailLengthShort() {
|
||||
if (this.data.lockTrackTailLength || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackTailLength('short')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackTailLength: 'short',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackTailLengthMedium() {
|
||||
if (this.data.lockTrackTailLength || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackTailLength('medium')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackTailLength: 'medium',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackTailLengthLong() {
|
||||
if (this.data.lockTrackTailLength || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackTailLength('long')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackTailLength: 'long',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackColorPreset(event: WechatMiniprogram.TouchEvent) {
|
||||
if (this.data.lockTrackColor || !mapEngine) {
|
||||
return
|
||||
}
|
||||
const color = event.currentTarget.dataset.color as TrackColorPreset | undefined
|
||||
if (!color) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackColorPreset(color)
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackColorPreset: color,
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackStyleClassic() {
|
||||
if (this.data.lockTrackStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackStyleProfile('classic')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackStyleProfile: 'classic',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetTrackStyleNeon() {
|
||||
if (this.data.lockTrackStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetTrackStyleProfile('neon')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
trackStyleProfile: 'neon',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerVisibleOn() {
|
||||
if (this.data.lockGpsMarkerVisible || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerVisible(true)
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerVisible: true,
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerVisibleOff() {
|
||||
if (this.data.lockGpsMarkerVisible || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerVisible(false)
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerVisible: false,
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerStyleDot() {
|
||||
if (this.data.lockGpsMarkerStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerStyle('dot')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerStyle: 'dot',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerStyleBeacon() {
|
||||
if (this.data.lockGpsMarkerStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerStyle('beacon')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerStyle: 'beacon',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerStyleDisc() {
|
||||
if (this.data.lockGpsMarkerStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerStyle('disc')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerStyle: 'disc',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerStyleBadge() {
|
||||
if (this.data.lockGpsMarkerStyle || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerStyle('badge')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerStyle: 'badge',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerSizeSmall() {
|
||||
if (this.data.lockGpsMarkerSize || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerSize('small')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerSize: 'small',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerSizeMedium() {
|
||||
if (this.data.lockGpsMarkerSize || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerSize('medium')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerSize: 'medium',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerSizeLarge() {
|
||||
if (this.data.lockGpsMarkerSize || !mapEngine) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerSize('large')
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerSize: 'large',
|
||||
})
|
||||
},
|
||||
|
||||
handleSetGpsMarkerColorPreset(event: WechatMiniprogram.TouchEvent) {
|
||||
if (this.data.lockGpsMarkerColor || !mapEngine) {
|
||||
return
|
||||
}
|
||||
const color = event.currentTarget.dataset.color as GpsMarkerColorPreset | undefined
|
||||
if (!color) {
|
||||
return
|
||||
}
|
||||
mapEngine.handleSetGpsMarkerColorPreset(color)
|
||||
persistStoredUserSettings({
|
||||
...loadStoredUserSettings(),
|
||||
gpsMarkerColorPreset: color,
|
||||
})
|
||||
},
|
||||
|
||||
handleSetSideButtonPlacementLeft() {
|
||||
if (this.data.lockSideButtonPlacement) {
|
||||
return
|
||||
@@ -1909,14 +2341,76 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
handleOpenContentCardDetail() {
|
||||
if (mapEngine) {
|
||||
handleOpenContentCardAction(event: WechatMiniprogram.BaseEvent) {
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
wx.showToast({
|
||||
title: '点击CTA',
|
||||
icon: 'none',
|
||||
duration: 900,
|
||||
})
|
||||
const actionType = event.currentTarget.dataset.type
|
||||
const action = typeof actionType === 'string' ? mapEngine.openCurrentContentCardAction(actionType) : null
|
||||
if (action === 'detail') {
|
||||
wx.showToast({
|
||||
title: '打开详情',
|
||||
icon: 'none',
|
||||
duration: 900,
|
||||
})
|
||||
mapEngine.openCurrentContentCardDetail()
|
||||
return
|
||||
}
|
||||
if (action === 'quiz') {
|
||||
return
|
||||
}
|
||||
if (action === 'photo') {
|
||||
wx.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['camera'],
|
||||
success: () => {
|
||||
if (mapEngine) {
|
||||
mapEngine.handleContentCardPhotoCaptured()
|
||||
}
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
if (action === 'audio') {
|
||||
if (!contentAudioRecorder) {
|
||||
contentAudioRecorder = wx.getRecorderManager()
|
||||
contentAudioRecorder.onStop(() => {
|
||||
contentAudioRecording = false
|
||||
if (mapEngine) {
|
||||
mapEngine.handleContentCardAudioRecorded()
|
||||
}
|
||||
})
|
||||
}
|
||||
const recorder = contentAudioRecorder
|
||||
if (!contentAudioRecording) {
|
||||
contentAudioRecording = true
|
||||
recorder.start({
|
||||
duration: 8000,
|
||||
format: 'mp3',
|
||||
} as any)
|
||||
wx.showToast({
|
||||
title: '开始录音',
|
||||
icon: 'none',
|
||||
duration: 800,
|
||||
})
|
||||
} else {
|
||||
recorder.stop()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleContentQuizAnswer(event: WechatMiniprogram.BaseEvent) {
|
||||
if (!mapEngine) {
|
||||
return
|
||||
}
|
||||
const optionKey = event.currentTarget.dataset.key
|
||||
if (typeof optionKey === 'string') {
|
||||
mapEngine.handleContentCardQuizAnswer(optionKey)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user