var locationMarker = new esmap.ESLocationMarker({
url: '../image/avatar.png',
arrow: true, // 是否显示朝向箭头
arrowSize: 90, // 箭头大小
arrowColor: '#50C1E9', // 箭头颜色
// arrowOffset: 1 // 箭头偏移大小
clip: {
type: 'circle', // 设置为圆形形状
strokeColor: '#FFF', // 边框颜色
strokeWidth: 3, // 边框宽度
},
fixedAngle: true, // 是否固定角度
size: 150, // 定位标注大小
height: 30, // 距离地面的高度
callback:()=>{ // 创建成功后的回调函数
}
});
map.addLocationMarker(locationMarker);
locationMarker.setPosition({
x: map.center.x, // 坐标
y: map.center.y,
fnum: 1, // 楼层层数
height: 1 // 距离地面的高度
})
map.removeLocationMarker(locationMarker)
locationMarker.rotateTo(-40); // 有过渡效果的更新定位标注方向
locationMarker.direction = -40; // 改变定位标注的方向
locationMarker.moveTo({
x: map.center.x + 10,
y: map.center.y + 10,
fnum: 1, // 楼层层数
height: 1 // 离地面的偏移量
time: 1.5 // 位移动画时间,单位(秒/s)
});
locationMarker.arrow = true; // 显示箭头 默认为false
locationMarker.fixedAngle = true; // 固定角度 默认为false (图标不随三维场景旋转)
标注支持手动控制显隐:
locationMarker.visible = false // 隐藏标注
locationMarker.visible = true // 显示标注