首页 / 浏览问题 / WebGIS / 问题详情
二维地图鼠标事件失灵
3EXP 2021年08月08日

使用产品: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);
  };

1个回答

您好,其他模块切回到地图模块中的其他模块指的是什么呢,您检查一下回调函数,以及代码的逻辑

1,000EXP 2021年08月09日
...