Results 1 to 3 of 3

Thread: MapControl evnet issue

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    14

    MapControl evnet issue

    Hi guys.

    When the map center is moved the event Center Changed event.

    Unfortunately the event happen when the user move the map and when programmatically I want the map center to move.

    I need to manage differently the two situation.

    Any idea on how to understand which condition cause the event ?

    I've already tested the Map Holding event (that should start when the user move the map) but it never fires.

    Thanks, Stefano

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    14

    Re: MapControl evnet issue

    Ok... sorry. I've found a simple solution.

    When I move the map by code, using the AWAIT prefix, I can setup my post motion operation sinuously,

    Thanks, Stefano

  3. #3
    Lively Member
    Join Date
    Jan 2020
    Posts
    120

    Re: MapControl evnet issue

    function initialize() {
    cityCenterLatLng = new google.maps.LatLng(cLat, cLong);
    options = {
    center : cityCenterLatLng,
    zoom : 15,
    mapTypeId : google.maps.MapTypeId.ROADMAP,
    disableDefaultUI : false,
    mapTypeControl : true,
    streetViewControl : true,
    mapTypeControlOptions : {
    style : google.maps.MapTypeControlStyle.DEFAULT,
    position : google.maps.ControlPosition.TOP_LEFT
    }
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), options);
    $("#map_canvas").css("border", "3px solid black");


    infoWindow = new google.maps.InfoWindow({});

    var c = {
    strokeColor: "#ff0000",
    strokeOpacity: 0.8,
    strokeWeight: 3,
    fillColor: "#b0c4de",
    fillOpacity: 0.50,
    map: map,
    center: cityCenterLatLng,
    radius: 1000,
    editable:true
    };

    circle = new google.maps.Circle(c);

    google.maps.event.addListener(circle, 'distance_changed', function()
    {
    alert('Circle moved');
    //displayInfo(circle);
    });

    google.maps.event.addListener(circle, 'position_changed', function()
    {
    alert('dictance changed');
    //displayInfo(circle);
    });
    }

    function displayInfo(widget)
    {
    var info = document.getElementById('info');
    info.innerHTML = 'Circle Center:' + circle.get('position') + ',Circle distance: ' +
    circle.get('distance');
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width