@vtx/map 1.0.6 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/VtxMap/BMap/Map.js +25 -9
- package/package.json +1 -1
package/lib/VtxMap/BMap/Map.js
CHANGED
|
@@ -1242,12 +1242,16 @@ var BaiduMap = function (_React$Component) {
|
|
|
1242
1242
|
var t = this;
|
|
1243
1243
|
bdNames.forEach(function (name) {
|
|
1244
1244
|
t._boundary.get(name, function (ary) {
|
|
1245
|
-
var
|
|
1246
|
-
|
|
1247
|
-
|
|
1245
|
+
var arr = [];
|
|
1246
|
+
ary.boundaries.forEach(function (item) {
|
|
1247
|
+
var id = 'boundary' + new Date().getTime() + Math.random();
|
|
1248
|
+
var paths = item.split(';').map(function (item, index) {
|
|
1249
|
+
return item.split(',');
|
|
1250
|
+
});
|
|
1251
|
+
arr.push({ id: id, rings: paths, name: name });
|
|
1252
|
+
t.state.boundaryInfo.push({ id: id, name: name });
|
|
1248
1253
|
});
|
|
1249
|
-
t.addPolygon(
|
|
1250
|
-
t.state.boundaryInfo.push({ id: id, name: name });
|
|
1254
|
+
t.addPolygon(arr);
|
|
1251
1255
|
});
|
|
1252
1256
|
});
|
|
1253
1257
|
}
|
|
@@ -1633,16 +1637,28 @@ var BaiduMap = function (_React$Component) {
|
|
|
1633
1637
|
break;
|
|
1634
1638
|
}
|
|
1635
1639
|
|
|
1640
|
+
/**
|
|
1641
|
+
* 用法
|
|
1642
|
+
* map.setVisiblePoints('lng,lat;lng,lat')
|
|
1643
|
+
*/
|
|
1636
1644
|
if (typeof arg === 'string') {
|
|
1637
1645
|
ary = arg.split(',');
|
|
1638
1646
|
obj = t.getFitView(ary);
|
|
1639
1647
|
} else if (arg instanceof Array) {
|
|
1640
|
-
|
|
1648
|
+
/**
|
|
1649
|
+
* 用法
|
|
1650
|
+
* map.setVisiblePoints([[lng,lat],[lng,lat]])
|
|
1651
|
+
*/
|
|
1652
|
+
if (arg[0] instanceof Array) {
|
|
1641
1653
|
var a = [];
|
|
1642
|
-
for (var i = 0; i <
|
|
1643
|
-
a
|
|
1654
|
+
for (var i = 0; i < arg.length; i++) {
|
|
1655
|
+
a.push(new BMap.Point(arg[i][0], arg[i][1]));
|
|
1644
1656
|
}
|
|
1645
1657
|
obj = t.state.gis.getViewport(a);
|
|
1658
|
+
/**
|
|
1659
|
+
* 用法
|
|
1660
|
+
* map.setVisiblePoints(['lng,lat','lng,lat'])
|
|
1661
|
+
*/
|
|
1646
1662
|
} else {
|
|
1647
1663
|
obj = t.getFitView(arg);
|
|
1648
1664
|
}
|
|
@@ -3155,7 +3171,7 @@ var BaiduMap = function (_React$Component) {
|
|
|
3155
3171
|
if (t.moveToTimer) {
|
|
3156
3172
|
clearInterval(t.moveToTimer);
|
|
3157
3173
|
}
|
|
3158
|
-
window.VtxMap[t.state.mapId] = null;
|
|
3174
|
+
window.VtxMap && (window.VtxMap[t.state.mapId] = null);
|
|
3159
3175
|
}
|
|
3160
3176
|
}]);
|
|
3161
3177
|
|