Refine map controls and compass auto-rotate highlights

This commit is contained in:
2026-03-23 14:58:36 +08:00
parent c7b9fde65a
commit cb190f3c66
8 changed files with 235 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -12,6 +12,7 @@ type CompassLabelData = {
radius: number
className: string
}
type SideButtonMode = 'all' | 'left' | 'right' | 'hidden'
type MapPageData = MapEngineViewState & {
showDebugPanel: boolean
statusBarHeight: number
@@ -23,10 +24,35 @@ type MapPageData = MapEngineViewState & {
panelSpeedValueText: string
compassTicks: CompassTickData[]
compassLabels: CompassLabelData[]
sideButtonMode: SideButtonMode
showLeftButtonGroup: boolean
showRightButtonGroups: boolean
showBottomDebugButton: boolean
}
const INTERNAL_BUILD_VERSION = 'map-build-110'
const INTERNAL_BUILD_VERSION = 'map-build-134'
const REMOTE_GAME_CONFIG_URL = 'https://oss-mbh5.colormaprun.com/wxmini/test/game.json'
let mapEngine: MapEngine | null = null
function buildSideButtonVisibility(mode: SideButtonMode) {
return {
sideButtonMode: mode,
showLeftButtonGroup: mode === 'all' || mode === 'left' || mode === 'right',
showRightButtonGroups: mode === 'all' || mode === 'right',
showBottomDebugButton: mode !== 'hidden',
}
}
function getNextSideButtonMode(currentMode: SideButtonMode): SideButtonMode {
if (currentMode === 'all') {
return 'left'
}
if (currentMode === 'left') {
return 'right'
}
if (currentMode === 'right') {
return 'hidden'
}
return 'left'
}
function buildCompassTicks(): CompassTickData[] {
const ticks: CompassTickData[] = []
for (let angle = 0; angle < 360; angle += 5) {
@@ -75,6 +101,7 @@ Page({
panelSpeedValueText: '0',
compassTicks: buildCompassTicks(),
compassLabels: buildCompassLabels(),
...buildSideButtonVisibility('left'),
} as MapPageData,
onLoad() {
@@ -101,6 +128,7 @@ Page({
panelSpeedValueText: '0',
compassTicks: buildCompassTicks(),
compassLabels: buildCompassLabels(),
...buildSideButtonVisibility('left'),
})
},
@@ -275,6 +303,21 @@ Page({
}
},
handleCycleSideButtons() {
this.setData(buildSideButtonVisibility(getNextSideButtonMode(this.data.sideButtonMode)))
},
handleToggleMapRotateMode() {
if (!mapEngine) {
return
}
if (this.data.orientationMode === 'heading-up') {
mapEngine.handleSetManualMode()
return
}
mapEngine.handleSetHeadingUpMode()
},
handleToggleDebugPanel() {
this.setData({
showDebugPanel: !this.data.showDebugPanel,
@@ -303,3 +346,29 @@ Page({

View File

@@ -18,20 +18,11 @@
<view class="map-stage__crosshair"></view>
<view class="map-stage__overlay">
<view class="map-stage__topbar" style="padding-top: {{topInsetHeight}}px;">
<view class="map-stage__meta">
<view class="map-stage__eyebrow">CMR MINI MAP</view>
<view class="map-stage__title">{{mapName}}</view>
<view class="map-stage__badge">{{mapReadyText}}</view>
</view>
</view>
<view class="map-stage__bottom">
<view class="compass-widget">
<view class="compass-widget__heading">{{sensorHeadingText}}</view>
<view class="compass-widget__edge-arrow"></view>
<view class="compass-widget__dial">
<view class="compass-widget__dial {{orientationMode === 'heading-up' ? 'compass-widget__dial--active' : ''}}">
<view class="compass-widget__glass"></view>
<view class="compass-widget__inner-shadow"></view>
<view class="compass-widget__card" style="transform: rotate({{rotationDeg}}deg);">
@@ -56,12 +47,46 @@
</view>
</view>
<cover-view class="screen-button-layer" wx:if="{{!showDebugPanel}}" style="top: {{topInsetHeight}}px;" bindtap="handleToggleDebugPanel">
<cover-view class="map-side-toggle" wx:if="{{!showDebugPanel}}" style="top: {{topInsetHeight}}px;" bindtap="handleCycleSideButtons">
<cover-view class="map-side-button map-side-button--icon">
<cover-image wx:if="{{sideButtonMode === 'left'}}" class="map-side-button__image" src="../../assets/btn_more2.png"></cover-image>
<cover-image wx:elif="{{sideButtonMode === 'hidden'}}" class="map-side-button__image" src="../../assets/btn_more1.png"></cover-image>
<cover-image wx:else class="map-side-button__image" src="../../assets/btn_more3.png"></cover-image>
</cover-view>
</cover-view>
<cover-view class="map-side-column map-side-column--left map-side-column--left-group" wx:if="{{!showDebugPanel && showLeftButtonGroup}}" style="top: {{topInsetHeight}}px;">
<cover-view class="map-side-button map-side-button--icon" bindtap="handleToggleMapRotateMode"><cover-image class="map-side-button__rotate-image {{orientationMode === 'heading-up' ? 'map-side-button__rotate-image--active' : ''}}" src="../../assets/btn_map_rotate_cropped.png"></cover-image></cover-view>
<cover-view class="map-side-button map-side-button--muted"><cover-view class="map-side-button__text">LOC</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">LOCK</cover-view></cover-view>
<cover-view class="map-side-button map-side-button--active"><cover-view class="map-side-button__text">SUN</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">EXIT</cover-view></cover-view>
</cover-view>
<cover-view class="map-side-column map-side-column--right-main" wx:if="{{!showDebugPanel && showRightButtonGroups}}" style="top: {{topInsetHeight}}px;">
<cover-view class="map-side-button"><cover-view class="map-side-button__text">N</cover-view></cover-view>
<cover-view class="map-side-button map-side-button--active"><cover-view class="map-side-button__text">DIR</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">COMP</cover-view></cover-view>
<cover-view class="map-side-button map-side-button--active"><cover-view class="map-side-button__text">GUIDE</cover-view></cover-view>
<cover-view class="map-side-button map-side-button--muted"><cover-view class="map-side-button__text">NET</cover-view></cover-view>
<cover-view class="map-side-button map-side-button--active"><cover-view class="map-side-button__text">GO</cover-view></cover-view>
</cover-view>
<cover-view class="map-side-column map-side-column--right-sub" wx:if="{{!showDebugPanel && showRightButtonGroups}}" style="top: {{topInsetHeight}}px;">
<cover-view class="map-side-button"><cover-view class="map-side-button__text">INFO</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">SET</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">m</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">PIN</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">LIST</cover-view></cover-view>
<cover-view class="map-side-button"><cover-view class="map-side-button__text">USER</cover-view></cover-view>
</cover-view>
<cover-view class="screen-button-layer screen-button-layer--bottom-left" wx:if="{{!showDebugPanel && showBottomDebugButton}}" bindtap="handleToggleDebugPanel">
<cover-view class="screen-button-layer__icon">
<cover-view class="screen-button-layer__line"></cover-view>
<cover-view class="screen-button-layer__stand"></cover-view>
</cover-view>
<cover-view class="screen-button-layer__text">屏幕</cover-view>
<cover-view class="screen-button-layer__text">调试</cover-view>
</cover-view>
<view class="race-panel">
@@ -249,3 +274,12 @@

View File

@@ -72,7 +72,7 @@
inset: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
justify-content: flex-end;
padding: 0 24rpx 248rpx;
box-sizing: border-box;
pointer-events: none;
@@ -118,7 +118,6 @@
.screen-button-layer {
position: absolute;
right: 24rpx;
width: 116rpx;
min-height: 116rpx;
padding: 18rpx 0 14rpx;
@@ -180,6 +179,90 @@
width: 100%;
}
.screen-button-layer--bottom-left {
left: 24rpx;
bottom: 244rpx;
}
.map-side-toggle {
position: absolute;
left: 24rpx;
z-index: 19;
}
.map-side-column {
position: absolute;
display: flex;
flex-direction: column;
gap: 16rpx;
padding-top: 12rpx;
z-index: 18;
}
.map-side-column--left {
left: 24rpx;
}
.map-side-column--left-group {
padding-top: 106rpx;
}
.map-side-column--right-main {
right: 118rpx;
}
.map-side-column--right-sub {
right: 24rpx;
}
.map-side-button {
width: 78rpx;
height: 78rpx;
border-radius: 22rpx;
background: rgba(248, 251, 244, 0.96);
box-shadow: 0 10rpx 26rpx rgba(22, 48, 32, 0.14);
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.map-side-button--icon {
width: 90rpx;
height: 90rpx;
padding: 0;
background: transparent;
box-shadow: none;
border-radius: 0;
}
.map-side-button__image {
width: 100%;
height: 100%;
}
.map-side-button__rotate-image {
width: 100%;
height: 100%;
border-radius: 16rpx;
box-sizing: border-box;
}
.map-side-button__rotate-image--active {
border: 1px solid rgba(231, 54, 33, 0.98);
}
.map-side-button--muted {
background: rgba(229, 233, 230, 0.92);
}
.map-side-button__text {
font-size: 18rpx;
line-height: 1.1;
font-weight: 700;
color: #163020;
text-align: center;
letter-spacing: 1rpx;
}
.compass-widget {
display: flex;
@@ -208,6 +291,11 @@
overflow: hidden;
}
.compass-widget__dial--active {
border-color: rgba(250, 252, 187, 0.98);
box-shadow: 0 0 0 2rpx rgba(253, 255, 214, 0.92), 0 0 18rpx rgba(247, 255, 173, 0.46), 0 6rpx 14rpx rgba(0, 0, 0, 0.14), inset 0 0 0 2rpx rgba(255, 255, 255, 0.28);
}
.compass-widget__glass,
.compass-widget__inner-shadow {
position: absolute;
@@ -706,7 +794,7 @@
.debug-modal__header {
display: flex;
align-items: center;
justify-content: space-between;
justify-content: flex-end;
gap: 20rpx;
padding: 28rpx 28rpx 20rpx;
border-bottom: 1rpx solid rgba(22, 48, 32, 0.08);
@@ -742,15 +830,15 @@
.info-panel__row {
display: flex;
align-items: center;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
gap: 24rpx;
padding: 10rpx 0;
border-bottom: 1rpx solid rgba(22, 48, 32, 0.08);
}
.info-panel__row--stack {
display: block;
align-items: flex-start;
}
.info-panel__row:last-of-type {
@@ -758,26 +846,29 @@
}
.info-panel__label {
width: 148rpx;
flex-shrink: 0;
font-size: 22rpx;
letter-spacing: 2rpx;
color: #5f7a65;
text-align: left;
text-transform: uppercase;
}
.info-panel__value {
flex: 1;
min-width: 0;
font-size: 25rpx;
line-height: 1.45;
color: #163020;
text-align: right;
word-break: break-all;
}
.info-panel__row--stack .info-panel__value {
display: block;
margin-top: 10rpx;
text-align: left;
margin-top: 0;
text-align: right;
color: #45624b;
line-height: 1.5;
}
.control-row {
@@ -785,7 +876,6 @@
gap: 14rpx;
margin-top: 18rpx;
}
.control-row--triple .control-chip {
font-size: 23rpx;
}
@@ -866,6 +956,22 @@