小程序
小游戏
企业微信
微信支付
扫描小程序码分享
- 当前 Bug 的表现(可附上截图)
获取的缩放级别和自己预先设置的缩放级别不一致
- 预期表现
通过getScale获取自己预先设置的缩放级别
- 复现路径
缩放地图,点击地图的一个maker,放大地图到指定缩放级别,无法正确放大
- 提供一个最简复现 Demo
无
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
发现同样的问题: 在真机上 this.mapCtx.getScale 与 设置的比例相同。 在开发工具上小了 2。比如:
.mapCtx.getScale
data: {
latitude: app.globalData.userpos.lat,
longitude: app.globalData.userpos.lng,
scale: 14 //这是设置的是 14
},
onShow: function () {
var that = this;
if (!that.mapCtx) {
that.mapCtx = wx.createMapContext('pointmap');
}
regionchange: function (e) { var that = this; if (e.type=='end'){ that.mapCtx.getScale({
success: function (sca) {
console.log(sca.scale) // 这里输出 12
} })
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
onMarkerClick:
function
(e) {
var
markerId = e.markerId
ids = markerId.split(
"-"
)
if
(flagMarkerC == ids[0]) {
//点击了城市的Marker
markerInfo = JSON.parse(ids[1])
this
.setData({
latitude: markerInfo.citylat,
longitude: markerInfo.citylng,
})
.mapCtx.moveToLocation()
scale: zoomShowAreaJuHeValue - 1
else
(flagMarkerP == ids[0]) {
//点击了区域的Marker
latitude: markerInfo.lat,
longitude: markerInfo.lng,
scale:
.initscaleSize
}, (result) => {
console.log(result)
mapChange:
() {
that =
.mapCtx.getScale({
//获取地图缩放级别
success:
(res) {
scale = res.scale
console.log(
"scale---》》》"
+ scale) //这里不准确
你好,测试问题未复现,请提供出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
发现同样的问题:
在真机上 this
.mapCtx.getScale与 设置的比例相同。 在开发工具上小了 2。比如:
data: {
latitude: app.globalData.userpos.lat,
longitude: app.globalData.userpos.lng,
scale: 14 //这是设置的是 14
},
onShow: function () {
var that = this;
if (!that.mapCtx) {
that.mapCtx = wx.createMapContext('pointmap');
}
},
regionchange: function (e) {
var that = this;
if (e.type=='end'){
that.mapCtx.getScale({
success: function (sca) {
console.log(sca.scale) // 这里输出 12
}
})
}
}
onMarkerClick:function(e) {varmarkerId = e.markerIdvarids = markerId.split("-")if(flagMarkerC == ids[0]) {//点击了城市的MarkervarmarkerInfo = JSON.parse(ids[1])this.setData({latitude: markerInfo.citylat,longitude: markerInfo.citylng,})this.mapCtx.moveToLocation()this.setData({scale: zoomShowAreaJuHeValue - 1})}elseif(flagMarkerP == ids[0]) {//点击了区域的MarkervarmarkerInfo = JSON.parse(ids[1])this.setData({latitude: markerInfo.lat,longitude: markerInfo.lng,})this.mapCtx.moveToLocation()this.setData({scale:this.initscaleSize}, (result) => {console.log(result)})}},mapChange:function() {varthat =thisthis.mapCtx.getScale({//获取地图缩放级别success:function(res) {varscale = res.scaleconsole.log("scale---》》》"+ scale) //这里不准确}})},你好,测试问题未复现,请提供出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。