我正在尝试在功能上创建一个点击/触摸来处理某些操作。它适用于 Chrome 浏览器。但是,当我在 Android 手机/平板电脑上安装 apk 时,它不起作用。
我的环境:
- Cordova 8
- Angular 6
- Open Layers 4.5
this.map.on('singleclick', (evt) => {
//console.log("map clicked");
let coord = this.map.getEventCoordinate(evt.originalEvent);
let feature = this.map.forEachFeatureAtPixel(evt.pixel,
(feature) => {
//console.log("Feature found on click!")
return feature;
}, {hitTolerance: 10});
if (feature) {
var coordinates = feature.getGeometry().getCoordinates();
//console.log("Feature Clicked: " + feature.getId() + "("+ feature.name +")"+ " [ " + coordinates[0] + ", " + coordinates[1] + " ]");
this.toggleTooltip(feature, true);
}
else {
//console.log("Feature not found on click");
this.toggleTooltip(null, null);
}
feature.changed();
});
我尝试使用hitTolerance
但没有任何运气。
请帮忙!