Open imran-saleem834 opened 7 years ago
i have this problem too
old code not effect in v7
map.panTo(cluster.main.getPosition());
At last i change the v7 source in self.fit
self.fit = chainToPromise(function () {
var bounds = gmElement('LatLngBounds');
foreach(previousResults, function (instances) {
if (instances !== map) {
foreach(instances, function (instance) {
if (instance) {
if (instance.getPosition && instance.getPosition()) {
bounds.extend(instance.getPosition());
} else if (instance.getBounds && instance.getBounds()) {
bounds.extend(instance.getBounds().getNorthEast());
bounds.extend(instance.getBounds().getSouthWest());
} else if (instance.getPaths && instance.getPaths()) {
foreach(instance.getPaths().getArray(), function (path) {
foreach(path.getArray(), function (latLng) {
bounds.extend(latLng);
});
});
} else if (instance.getPath && instance.getPath()) {
foreach(instance.getPath().getArray(), function (latLng) {
bounds.extend(latLng);
});
} else if (instance.getCenter && instance.getCenter()) {
bounds.extend(instance.getCenter());
} else if ( instance.markers && instance.markers() ) {
foreach(instance.markers(), function (marker) {
bounds.extend(marker.position);
});
}
}
});
}
});
if (!bounds.isEmpty()) {
map.fitBounds(bounds);
}
return true;
});
add elseif for cluster :
else if ( instance.markers && instance.markers() ) {
foreach(instance.markers(), function (marker) {
bounds.extend(marker.position);
});
When i am use maker function then fit is work perfect, but on time of cluster is not working