Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

105
Visualizações
Bing Maps V8 JS API GroundOverlay beneathLabels mouse events

I use a transparent png as groundoverlay covering the whole map.I must set beneathLabels=false because the label-layer of the map makes some parts of my overlay unreadable. But with beneathLabels=false all the mouse/keyboard events goes to my groundoverlay not to the map anymore. I know thi sis documented but I don't want that, how can I route that events to the map? In the google-api I simple declare the groundoverlay as non-clickable. Or ist there any other way than groundoverly to put a transparent png above the whole map without capturing also all events ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I believe to get the mouse events to go through the ground overlay the pointer-events CSS style needs to be set to none. I believe this isn't supported for images in IE10 (min supported browser by Bing Maps when this SDK was released, so likely why this isn't a built-in option). Doing some experimenting, the following seems to work:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script>
    var map, overlay;

    function GetMap() {
        map = new Microsoft.Maps.Map('#myMap', {
            center: new Microsoft.Maps.Location(-16.366, -46.8945),
            zoom: 17
        });

        overlay = new Microsoft.Maps.GroundOverlay({
            bounds: Microsoft.Maps.LocationRect.fromEdges(-16.36523189120857, -46.89686679103114, -16.3674247514764, -46.89337059621697),
            imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/e/e9/Foto_a%C3%A9rea_de_Una%C3%AD_detalhando_o_c%C3%B3rrego_Canabrava_3.jpg',
            rotation: 298,          
            beneathLabels: false
        });
        map.layers.insert(overlay);
        
        //Access the underlying image object and disable pointer events so that mouse events flow through to the map.
        overlay._img.style.pointerEvents = 'none';
    }
    </script>
    <script async defer src="https://bing.com/api/maps/mapcontrol?callback=GetMap&key=[Your Bing Maps Key]"></script>
</head>
<body>
    <div id="myMap" style="position:relative;width:800px;height:600px;"></div>
</body>
</html>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda