Openlayers ol.interaction.Select传值问题

说明:

在使用ol.interaction.Select时,我定义的变量做用域做用不到其回调函数里,但我在select结果中,须要用到这些变量函数

解决方案:

虽想了个办法解决了,但不知道是否是合理;是否有其余解决方法this

        let selecthover = new ol.interaction.Select({
            condition: ol.events.condition.click,
            layers: [animationLineLayer]
        });
        selecthover.set("arrPoints", that._pointArray);
        selecthover.on("select", function (evt) {
            var tmpPointsArray = this.getProperties()["arrPoints"];
        });
相关文章
相关标签/搜索