|
|
@ -60,7 +60,8 @@ export default class TbMapWidgetV2 { |
|
|
|
|
|
|
|
|
var minZoomLevel = this.drawRoutes ? 18 : 15; |
|
|
var minZoomLevel = this.drawRoutes ? 18 : 15; |
|
|
|
|
|
|
|
|
this.initBounds = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initCallback = function() { |
|
|
var initCallback = function() { |
|
|
tbMap.update(); |
|
|
tbMap.update(); |
|
|
@ -89,6 +90,9 @@ export default class TbMapWidgetV2 { |
|
|
} else if (mapProvider === 'tencent-map') { |
|
|
} else if (mapProvider === 'tencent-map') { |
|
|
this.map = new TbTencentMap($element,this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType); |
|
|
this.map = new TbTencentMap($element,this.utils, initCallback, this.defaultZoomLevel, this.dontFitMapBounds, minZoomLevel, settings.tmApiKey, settings.tmDefaultMapType); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tbMap.initBounds = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setCallbacks(callbacks) { |
|
|
setCallbacks(callbacks) { |
|
|
@ -444,6 +448,7 @@ export default class TbMapWidgetV2 { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function updateLocations(data, datasources) { |
|
|
function updateLocations(data, datasources) { |
|
|
|
|
|
|
|
|
var locationsChanged = false; |
|
|
var locationsChanged = false; |
|
|
var bounds = tbMap.map.createBounds(); |
|
|
var bounds = tbMap.map.createBounds(); |
|
|
var dataMap = toLabelValueMap(data, datasources); |
|
|
var dataMap = toLabelValueMap(data, datasources); |
|
|
@ -457,8 +462,11 @@ export default class TbMapWidgetV2 { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (locationsChanged && tbMap.initBounds) { |
|
|
if (locationsChanged && tbMap.initBounds) { |
|
|
tbMap.map.fitBounds(bounds); |
|
|
tbMap.initBounds = !datasources.every( |
|
|
tbMap.initBounds = false; |
|
|
function (ds) { |
|
|
|
|
|
return ds.dataReceived === true; |
|
|
|
|
|
}); |
|
|
|
|
|
tbMap.map.fitBounds(bounds); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -480,7 +488,6 @@ export default class TbMapWidgetV2 { |
|
|
content = fillPattern(settings.tooltipPattern, settings.tooltipReplaceInfo, data); |
|
|
content = fillPattern(settings.tooltipPattern, settings.tooltipReplaceInfo, data); |
|
|
return fillPatternWithActions(content, 'onTooltipAction', tooltip.markerArgs); |
|
|
return fillPatternWithActions(content, 'onTooltipAction', tooltip.markerArgs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.map && this.map.inited() && this.subscription) { |
|
|
if (this.map && this.map.inited() && this.subscription) { |
|
|
if (this.subscription.data) { |
|
|
if (this.subscription.data) { |
|
|
if (!this.locations) { |
|
|
if (!this.locations) { |
|
|
|