【发布时间】:2019-03-05 16:28:41
【问题描述】:
因此,当我将鼠标悬停在任何明显突出显示的功能上时,我正在尝试将选择交互添加到我的地图中。
import Select from 'ol/interaction/select';
import pointerMove from 'ol/events/condition.js'
this.selectPointerMove = new Select({
condition: pointerMove
});
this.coreMapComponent.map.addInteraction(this.selectPointerMove);
条件字段抛出错误-
Type 'typeof events' is not assignable to type 'EventsConditionType'.
Type 'typeof events' provides no match for the signature '(event: MapBrowserEvent): boolean'.
如果没有条件,它可以在鼠标单击时正常工作。
如果相关的话,应该在 Angular 6 项目中使用“@types/ol”:“^4.6.2”来提及这一点。
【问题讨论】:
-
试试
import {pointerMove} from 'ol/events/condition'; -
是的,很抱歉应该提到我已经尝试过了,不幸的是同样的结果。
-
尝试删除
.js之后的condition=>import pointerMove from 'ol/events/condition' -
我也试过了,不幸的是没有运气。
标签: angular typescript openlayers openlayers-3