场景:标绘
绘制完多边形后,在多边形上右键,不弹出右键菜单,原因是select控件的rightclick回调函数没触发,如果绘制完移动或缩放地图,然后再多边形上右键,则可正常触发右键回调函数。请问是什么原因??
部分代码如下:
// plot layer select control
var callbacks = {
rightclick: function (currentFeature) {
createCustomMenu(currentFeature);
},
over: function (currentFeature) {
// console.log('mouseover');
},
out: function (currentFeature) {
// console.log('mouseout');
}
}
_plotSelect = new SuperMap.Control.SelectFeature(
[lineLayer, polygonLayer], {
callbacks: callbacks,
onSelect:function(){
console.log(567)
},
onUnselect:function(){
console.log(999)
}
});
// 加到地图
map.addControl(_plotSelect);
//激活 - 激活是写在多边形绘制完成的回调函数中的
_plotSelect.active();