自動調整が削除されたアイテムを処理しないようです。
ただし、これを独自に実装することもできます。
与えられた例では、この変更はそれを行います:
1.
次の行を置き換えます。
tmp[ ville.region ] = true;
に:
if( tmp[ ville.region ])
{
tmp[ ville.region ].bounds.extend(new google.maps.LatLng(ville.lat,ville.lng))
}
else
{
tmp[ ville.region ]=
{
bounds:new google.maps.LatLngBounds(new google.maps.LatLng(ville.lat,ville.lng)),
checked:true
}
}
各地域の LatLngBounds とステータス(チェック済み)を保存します
2.
この直後に追加:
$.each(markers, function(i, marker){
marker.setMap( checked ? map : null);
});
これらの行:
tmp[region].checked=checked;
var bounds=new google.maps.LatLngBounds();
$.each(tmp,function(i,o)
{
if(o.checked)
{
bounds.union(o.bounds);
}
}
);
map.fitBounds(bounds);
現在の地域のチェック済みステータスを設定し、すべての可視地域の LatLngBounds を計算します。結果は map.fitBounds() の引数として使用されます
デモ: http://jsfiddle.net/doktormolle/nBtVB/