Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.45 KB

File metadata and controls

52 lines (40 loc) · 1.45 KB

⚠️ This document is aim for older versions (from 2.0.0 to 2.2.9). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

circle.setClickable()

Change clickability of the circle.

<div class="map" id="map_canvas">
  <span class="smallPanel"><input type="checkbox" id="toggleCheckbox" checked="checked">circle.setClickable(true)</span>
</div>
var GOOGLE = {"lat" : 37.422858, "lng" : -122.085065};
var mapDiv = document.getElementById("map_canvas");

// Create a map with specified camera bounds
var map = plugin.google.maps.Map.getMap(mapDiv);
map.addEventListener(plugin.google.maps.event.MAP_READY, function() {

    // Add a circle
    map.addCircle({
        'center': GOOGLE,
        'radius': 300,
        'strokeColor' : '#AA00FF',
        'strokeWidth': 5,
        'fillColor' : '#880000',
        'clickable' : true   // default = false
    }, function(circle) {

        map.moveCamera({
          target: circle.getBounds()
        });

        var checkbox = document.getElementById("toggleCheckbox");
        checkbox.addEventListener("change", function() {

            // Change the clickable property
            circle.setClickable(checkbox.checked);
        });

        // Catch the CIRCLE_CLICK event
        circle.on(plugin.google.maps.event.CIRCLE_CLICK, function(latLng) {
            alert("The circle is clicked!");
        });
    });

});