map-widget2_and_subscription_file_update
This commit is contained in:
parent
0a950a4916
commit
49d623391e
@ -648,6 +648,12 @@ export default class Subscription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataUpdated(sourceData, datasourceIndex, dataKeyIndex, apply) {
|
dataUpdated(sourceData, datasourceIndex, dataKeyIndex, apply) {
|
||||||
|
for (var x = 0; x < this.datasourceListeners.length; x++) {
|
||||||
|
this.datasources[x].dataReceived = this.datasources[x].dataReceived === true;
|
||||||
|
if (this.datasourceListeners[x].datasourceIndex === datasourceIndex && sourceData.data.length > 0) {
|
||||||
|
this.datasources[x].dataReceived = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.notifyDataLoaded();
|
this.notifyDataLoaded();
|
||||||
var update = true;
|
var update = true;
|
||||||
var currentData;
|
var currentData;
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user