Merge pull request #1446 from MrKartoshka/map_fix

Fix init fit to bounds
This commit is contained in:
Igor Kulikov 2019-02-01 15:19:39 +02:00 committed by GitHub
commit 7952f8d5b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -539,10 +539,14 @@ export default class TbMapWidgetV2 {
}
}
if (locationsChanged && tbMap.initBounds) {
tbMap.initBounds = !datasources.every(
let dataReceived = datasources.every(
function (ds) {
return ds.dataReceived === true;
});
let dataValid = dataReceived && dataMap.dsDataMap.every(function (ds) {
return !(!ds[tbMap.locationSettings.latKeyName] && !ds[tbMap.locationSettings.lngKeyName]);
});
tbMap.initBounds = !dataValid;
tbMap.map.fitBounds(bounds);
}
}