Commit 0fd84dc311a9b4d470ab4549b01c3e1f00ecb5fa

Authored by Maksym Dudnik
1 parent b1849e98

Fix init fit to bounds

@@ -539,10 +539,14 @@ export default class TbMapWidgetV2 { @@ -539,10 +539,14 @@ export default class TbMapWidgetV2 {
539 } 539 }
540 } 540 }
541 if (locationsChanged && tbMap.initBounds) { 541 if (locationsChanged && tbMap.initBounds) {
542 - tbMap.initBounds = !datasources.every( 542 + let dataReceived = datasources.every(
543 function (ds) { 543 function (ds) {
544 return ds.dataReceived === true; 544 return ds.dataReceived === true;
545 }); 545 });
  546 + let dataValid = dataReceived && dataMap.dsDataMap.every(function (ds) {
  547 + return !(!ds[tbMap.locationSettings.latKeyName] && !ds[tbMap.locationSettings.lngKeyName]);
  548 + });
  549 + tbMap.initBounds = !dataValid;
546 tbMap.map.fitBounds(bounds); 550 tbMap.map.fitBounds(bounds);
547 } 551 }
548 } 552 }