mapcontext.stopsmoothdrawpolyline(object object)
基础库 或更高版本; 且 支付宝客户端 10.3.86 或更高版本; 若版本较低,建议采取 兼容处理 。
小程序开发者工具: 不支持。
主体: 企业支付宝小程序 、 个人支付宝小程序
结束由 mapcontext.smoothdrawpolyline 发起的折线绘制动画。
object object
查看示例
属性 | 类型 | 默认值 | 必填 | 描述 |
---|---|---|---|---|
polylineid | number | - | 是 | 折线 id |
success | function | - | 否 | 调用成功的回调函数 |
fail | function | - | 否 | 调用失败的回调函数 |
complete | function | - | 否 | 调用结束的回调函数(调用成功、失败都会执行) |
fail 回调的参数为 object,error
属性为错误码,errormessage
属性为错误消息。
错误码 | 错误消息 | 凯发app官方网站的解决方案 |
---|---|---|
10001 | 未指定polylineid |
请传入有效的 polylineid 值 |
mapcontext.stopsmoothdrawpolyline axml 代码
mapcontext.stopsmoothdrawpolyline js 代码
<view>
<map
id="map"
longitude="120.125872"
latitude="30.272960"/>
<view ontap="smoothdrawpolyline">绘制折线</view>
<view ontap="stopsmoothdrawpolyline">停止绘制动画</view>
</view>
page({
data: {
mapctx: null
},
onready() {
this.data.mapctx = my.createmapcontext('map');
},
smoothdrawpolyline() {
const anipoints = [
{
latitude: 30.272960,
longitude: 120.125872,
},
{
latitude: 30.276860,
longitude: 120.129872,
}
];
this.data.mapctx.smoothdrawpolyline({
// 折线 id
polylineid: 10,
// 经纬度数组,指定绘制路径
points: anipoints,
// 线路颜色
color: '#00ff00',
// 是否虚线
dottedline: false,
// 动画执行时间
duration: 4000,
success: res => {
console.log('success' json.stringify(res))
},
fail: err => {
console.log('err' json.stringify(err))
}
});
},
stopsmoothdrawpolyline() {
this.mapctx.stopsmoothdrawpolyline({
polylineid: 10,
success: res => {
console.log('success' json.stringify(res))
},
fail: err => {
console.log('err' json.stringify(err))
}
})
},
});