简体   繁体   English

将鼠标悬停在Mapbox中的Popup上时,Mousemove停止触发

[英]Mousemove stops triggering when hovering on Popup in Mapbox

I need to know when I hover a Popup, 我需要知道我何时悬停弹出窗口

So im using the mousemove event to log the features of the map. 因此,即时通讯使用mousemove事件记录地图的功能。

It works fine everywhere, except when I hover the Popup. 它在任何地方都可以正常工作,除非我将鼠标悬停在弹出窗口上。

As soon as I enter the Popup, there is no event being fired. 我一进入弹出窗口,就不会触发任何事件。

I need to know when I'm hovering on it, and a copy a reference of it. 我需要知道何时将鼠标悬停在它上面,并复制它的引用。

This is the code: 这是代码:

map.on('mousemove', function (e) {
  var features = map.queryRenderedFeatures(e.point);
  console.log( 'Logging' )

});

Very simple, but as soon as the mouse is in the popup, the browser stops loggin. 非常简单,但是只要鼠标在弹出窗口中,浏览器就会停止登录。

Any ideas? 有任何想法吗?

Try to caputure 'mousemove' events also in the popup. 尝试在弹出窗口中捕获“ mousemove”事件。 The popup should have the class mapboxgl-popup so you could try the following function (example in JQuery): 弹出窗口应该具有class mapboxgl-popup类,因此您可以尝试以下功能(JQuery中的示例):

$('.mapboxgl-popup').on('mousemove', function (e) {
  var features = map.queryRenderedFeatures(e.point);
  console.log( 'Logging' )
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM