Support » Plugin: Events Manager » Fix for: Bounds of [locations_map] not set correctly

  • When I was inserting the [locations_map], the bounds were coming out set all strange.

    I added this javascript function to the page that the map lived on, and it’s good to go.

    jQuery(document).on('em_maps_locations_hook', function(e, map, data) {
    	var bounds = new google.maps.LatLngBounds();
    	for (var i = 0; i < data.length; i++) {
    		if (!(data[i].location_latitude == 0 && data[i].location_longitude == 0)) {
    			var latitude = parseFloat(data[i].location_latitude);
    			var longitude = parseFloat(data[i].location_longitude);
    			bounds.extend(new google.maps.LatLng(latitude,longitude));
    		}
    	}
    	map.fitBounds(bounds);
    });
    

    This really just needs to be fixed in the plugin itself and could replace the logic in lines 880-891 in events-manager/includes/js/events-manager.js?ver=5.6624

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    thanks for sharing; will let the devs know about this

    Plugin Author Marcus

    (@netweblogic)

    Thanks for the suggestion. I agree that this is a more graceful way to go about it. It doesn’t fix it for every occasion, but it makes more sense to let Google handle the logistics 🙂

    It’ll be out in the next upcoming update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fix for: Bounds of [locations_map] not set correctly’ is closed to new replies.