Commit d9c1f73a by aa.gusti

perbaikan gmap.js

1 parent 55d83873
...@@ -40,17 +40,17 @@ function initMap() { ...@@ -40,17 +40,17 @@ function initMap() {
map.data.setControls(gmapControls); map.data.setControls(gmapControls);
google.maps.event.addListener(map, "center_changed", function (e) { // google.maps.event.addListener(map, "center_changed", function (e) {
latLngObj = map.getCenter(); // latLngObj = map.getCenter();
console.log("lat long object " + latLngObj); // console.log("lat long object " + latLngObj);
console.log(e); // console.log(e);
}); // });
google.maps.event.addListener(map.data, "center_changed", function (e) { // google.maps.event.addListener(map.data, "center_changed", function (e) {
latLngObj = map.data.getCenter(); // latLngObj = map.data.getCenter();
console.log("lat long object data " + latLngObj); // console.log("lat long object data " + latLngObj);
console.log(e); // console.log(e);
}); // });
google.maps.event.addListener(map.data, "addfeature", function (e) { google.maps.event.addListener(map.data, "addfeature", function (e) {
if (map.data.map.data.getControls() !== null) { if (map.data.map.data.getControls() !== null) {
...@@ -62,7 +62,9 @@ function initMap() { ...@@ -62,7 +62,9 @@ function initMap() {
selectedFeature = e.feature; selectedFeature = e.feature;
btnRemove.disabled = false; btnRemove.disabled = false;
map.setCenter(center); map.setCenter(center);
// map.setZoom(18); // console.log("lat long object " + center);
map.panTo(center);
map.setZoom(18);
} else { } else {
let bounds = new google.maps.LatLngBounds(); let bounds = new google.maps.LatLngBounds();
bounds = extendBound(bounds, e.feature); bounds = extendBound(bounds, e.feature);
...@@ -244,14 +246,16 @@ function getFeatureBounds() { ...@@ -244,14 +246,16 @@ function getFeatureBounds() {
} }
function setControls() { function setControls() {
console.log("setControl");
let total = 0; let total = 0;
let bounds = new google.maps.LatLngBounds(); let bounds = new google.maps.LatLngBounds();
map.data.forEach(function (e) { map.data.forEach(function (e) {
total++; total++;
bounds = extendBound(bounds, e); bounds = extendBound(bounds, e);
}); });
console.log(bounds);
if (total > 0) { if (total > 0) {
map.fitBounds(bounds); // map.fitBounds(bounds);
map.data.setDrawingMode(null); map.data.setDrawingMode(null);
map.data.setControls(null); map.data.setControls(null);
let zoomLevel = map.getZoom(); let zoomLevel = map.getZoom();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!