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

224
Visualizações
Update size of a circle on radius update Google Maps v3

I'm new in javascript and I try to update the size of a circle in a google map when the value of the radius is updated but it doesn't work.

I tried to return the value of cityCircle when I update the radius but it returns "undefined".

setTimeout(function() {
    google.maps.event.trigger(map, 'resize');

    if (num_places > 0) {

        var radiusmap = s.radius;
        var cityCircle;

        function addCircle() {
            if (cityCircle) {
                cityCircle.setMap(null);
            } else {
                cityCircle = new google.maps.Circle({
                    radius: radiusmap * 1000,
                    fillColor: '#bce3e4',
                    fillOpacity: 0.2,
                    strokeColor: '#7cc4c5',
                    strokeOpacity: 1,
                    strokeWeight: 1
                });
            cityCircle.bindTo('center', centerMarker, 'position');
            cityCircle.bindTo('map', centerMarker, 'map');
            }
        }

        if (radiusmap == 100) {
            addCircle();
            map.setCenter(latlng);
            map.setZoom(8);
        }
        if (radiusmap == 50) {
            console.log(cityCircle);
            addCircle();
            map.setZoom(9);
        }
        if (radiusmap == 20) {
            addCircle();
            map.setZoom(10);
        }
        if (radiusmap == 5) {
            addCircle();
            map.setZoom(12);
        }
        if (radiusmap == 0) {
            map.setZoom(2);
        }

    } else {
        map.setZoom(s.zoom);
        map.setCenter(latlng);
    }
}

Any help would be really appreciated :)

about 4 years ago · Juan Pablo Isaza
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