fix map marker width

This commit is contained in:
Timi
2025-12-18 19:21:46 +08:00
parent 186a74bc77
commit 6f74559c01
11 changed files with 130 additions and 128 deletions

View File

@ -55,28 +55,21 @@
.map {
padding: 0;
}
.mini-map {
width: 100%;
height: 520rpx;
}
.instance {
width: 100%;
height: 520rpx;
.custom-callout {
width: fit-content;
max-width: 400rpx;
background: var(--theme-bg-card-secondary);
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, .15);
border-radius: 8rpx;
.callout-content {
padding: 12rpx 20rpx;
.callout-text {
.marker {
width: calc(var(--title-length) * 28rpx);
color: var(--theme-text-primary);
padding: 8rpx;
overflow: hidden;
font-size: 28rpx;
background: var(--theme-bg-card);
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, .15);
white-space: nowrap;
border-radius: 8rpx;
text-overflow: ellipsis;
}
}

View File

@ -120,7 +120,7 @@ Page({
width: 24,
height: 30,
customCallout: {
anchorY: 0,
anchorY: -2,
anchorX: 0,
display: "ALWAYS"
}

View File

@ -35,7 +35,7 @@
<t-cell class="map">
<map
slot="description"
class="mini-map"
class="instance"
latitude="{{location.lat}}"
longitude="{{location.lng}}"
markers="{{mapMarkers}}"
@ -43,10 +43,8 @@
show-location
>
<cover-view slot="callout">
<cover-view class="custom-callout" marker-id="0">
<cover-view class="callout-content">
<cover-view class="callout-text">{{location.title || '地点'}}</cover-view>
</cover-view>
<cover-view class="marker" marker-id="0" style="--title-length: {{location.title.length}}">
{{location.title || '地点'}}
</cover-view>
</cover-view>
</map>