Browse Source
Merge pull request #1446 from MrKartoshka/map_fix
Fix init fit to bounds
pull/1448/head
Igor Kulikov
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
1 deletions
-
ui/src/app/widget/lib/map-widget2.js
|
|
@ -539,10 +539,14 @@ export default class TbMapWidgetV2 { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (locationsChanged && tbMap.initBounds) { |
|
|
if (locationsChanged && tbMap.initBounds) { |
|
|
tbMap.initBounds = !datasources.every( |
|
|
let dataReceived = datasources.every( |
|
|
function (ds) { |
|
|
function (ds) { |
|
|
return ds.dataReceived === true; |
|
|
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); |
|
|
tbMap.map.fitBounds(bounds); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|