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

167
Visualizações
setIcon() changing Icon but not changing addressable DOM on map with large number of markers

I’m first changing the icon of a marker with .setIcon(). Then I’m rotating the icon with:

$('img[src="https://' + thedomain +
    '/xplorit_common/assets/SVG/map_radar.svg"]').css({
  'transform': 'rotate(' + adj_offset_bearing + 'deg)',
});

Everything works just fine with a small number of markers. But when I have upwards of 200+ markers the icon will not rotate. The marker image does change but the <img> src attribute does not change when viewing Elements in Dev Tools( even when searching for map_radar.svg ). Which, circling back, makes sense as to the icon not rotating; since the value is not actually addressable in the DOM. But does not make sense that the "correct" icon is visible

I’ve beaten this horse to death and need some outside input. Any ideas?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Set optimized:false option

If you use specific markers with custom icons with .svg, you can experiment some difficulties with large number of markers. To bypass this problem, you need to disable the optimized rendering property set by default when you build a marker. To do it, just add line optimized:false when you set each of your markers:

var marker = new google.maps.Marker({
   position: myLatlng,
   map: myGmap,
   icon: {url: mySvgIconUrl},
   optimized: false
});

Or do it with the setOption() method :

marker.setOptions({'optimized':false});

For more infos about it you can look this section of the documentation

about 4 years ago · Santiago Trujillo 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