I have the forEachFeatureAtPixel function and try to trigger an event on click on a point layer with a custom icon. However, the performance on touch devices is really bad. I need to click several times until it triggers the event (sometimes it doesn'tdo it at all..) . I also used the moveTolerence feature for the map, but still have the same issues. On mouse click on my desktop PC everything works like a charme. What am I missing to make the performance as smooth as on a desktop PC?
This is my code:
$(document).ready(function() {
map.on('singleclick', function(evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
return feature;
}, {hitTolerance:10});
var layer = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
return layer;
}, {hitTolerance: 15});
if (feature) {
if (layer === vectorLayerFB) {
window.open('https://www.example.com', '_blank');
}
if (layer === vectorLayerBlog) {
window.location = 'www.example.com';
}
}
});
[...]
});
hitTolerance
value as 30 something?