Openlayers 3 - Interaction and pointermove -
i'm trying activate interaction when mouseover inside feature.
it working so... problem if move mouse interaction keep active.
is bug on ol3, or should in different way?
code: http://jsfiddle.net/gmaq54dm/3/
olmap.on("pointermove", function (e) { if (e.dragging) { return; } var map = e.map; console.log(e.pixel); var feature = map.foreachfeatureatpixel(e.pixel, function(feature, layer) { return feature; }); var hit = (feature) ? true : false; console.log(hit); oldraw.setactive(hit); });
thanks
this bug in application, not in openlayers. need make sure hit-detect features vector layer, not draw layer. change foreachfeatureatpixel
function to
var feature = map.foreachfeatureatpixel(e.pixel, function(feature, layer) { return feature; }, null, function(layer) { return layer == vectorlayer });
the last argument adds layer filter hit-detect features on vector layer.
updated, working jsfiddle: http://jsfiddle.net/gmaq54dm/4/
Comments
Post a Comment