使用产品:iclient-ol.js
问题详细描述:使用了pointermove地图事件,通过forEachFeatureAtPixel方法判断鼠标是否经过要素,当系统直接打开时,没有错误,但从其它模块切回地图模块时,就会循环调用执行iclient-ol.js中的forEachFeatureAtPixel方法,类似于死循环
external_ol_Map_default.a.prototype.forEachFeatureAtPixel = external_ol_Map_default.a.prototype.Tc = function (pixel, callback, opt_options, e) {
//如果满足高效率图层选取要求优先返回高效率图层选中结果
var layerFilter = opt_options && opt_options.layerFilter ? opt_options.layerFilter : function () {
return true;
};
var layers = this.getLayers().getArray();
var resolution = this.getView().getResolution();
var coordinate = this.getCoordinateFromPixel(pixel);
for (var i = 0; i < layers.length; i++) {
var layer = layers[i];
if (layer.getVisible() && layerFilter.call(null, layer)) {
fun(layer, coordinate, resolution, callback, pixel, e);
}
}
return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
};