uni-app map marker callout 在安卓手机上不随着标注点移动
uni-app map marker callout 在安卓手机上不随着标注点移动
问题:
地图添加marker
marker:{
id:202104141,
latitude:“39.989792”,
longitude:“116.481181”,
callout:{
content:“测试文本”
}
}
使用方法修改标注点位置
translateMarker({
markerId: 202104141,
destination: {
latitude: “39.927761”,
longitude:“116.391467”
},
rotate:30, // 设置角度 之后 气泡标签无法随着位置进行变更
})
问题 :
标注点位置有变化 标注点气泡文本在原有位置;
附件为手机型号,代码
更多关于uni-app map marker callout 在安卓手机上不随着标注点移动的实战教程也可以访问 https://www.itying.com/category-93-b0.html
问题已确认
更多关于uni-app map marker callout 在安卓手机上不随着标注点移动的实战教程也可以访问 https://www.itying.com/category-93-b0.html
3.1.9
HX3.1.11已修复该问题
请修复一下,map中marker的label问题啊,用文档的x,y不能修改label位置,项目等着用啊
这是一个已知的 uni-app map 组件在 Android 平台上的兼容性问题。当使用 translateMarker
方法移动标注点时,callout 气泡不会跟随 marker 同步移动,而是停留在原始位置。
问题原因: 在 Android 原生地图组件中,callout 气泡的定位机制与 marker 本体不同步,特别是在执行平移、旋转等动画操作时,callout 的坐标更新存在延迟或缺失。
解决方案:
-
重新创建 marker(推荐)
// 先移除原有 marker this.mapContext.removeMarkers([202104141]); // 创建新位置的 marker this.mapContext.addMarker({ id: 202104141, latitude: "39.927761", longitude: "116.391467", callout: { content: "测试文本" } });
-
使用自定义覆盖层替代 callout 通过
mapContext.addGroundOverlay()
在指定位置添加文本覆盖层,在移动 marker 时同步更新覆盖层位置。 -
临时隐藏/显示 callout
// 移动前隐藏 this.mapContext.hideMarkerCallout({ markerId: 202104141 }); // 移动后显示 this.mapContext.translateMarker({ markerId: 202104141, destination: { latitude: "39.927761", longitude: "116.391467" }, autoRotate: false, callback: () => { this.mapContext.showMarkerCallout({ markerId: 202104141 }); } });