@vtx/map 1.1.4 → 1.1.5

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.
@@ -315,8 +315,7 @@ var OlMap = function (_React$Component) {
315
315
  mapZoomLevel = _t$props2.mapZoomLevel,
316
316
  minZoom = _t$props2.minZoom,
317
317
  maxZoom = _t$props2.maxZoom;
318
- var _olProps$projection = olProps.projection,
319
- projection = _olProps$projection === undefined ? 'EPSG:4326' : _olProps$projection,
318
+ var projection = olProps.projection,
320
319
  olCoverage = olProps.olCoverage;
321
320
 
322
321
  if (window.OlMap) {
@@ -324,6 +323,15 @@ var OlMap = function (_React$Component) {
324
323
  } else {
325
324
  window.OlMap = {};
326
325
  }
326
+ if (!minZoom) {
327
+ minZoom = 2;
328
+ }
329
+ if (!maxZoom) {
330
+ maxZoom = 19;
331
+ }
332
+ if (!projection) {
333
+ projection = 'EPSG:4326';
334
+ }
327
335
  window.OlMap[mapId] = t.state.gis = new ol.Map({
328
336
  target: mapId.toString(),
329
337
  view: new ol.View({
@@ -2954,10 +2962,13 @@ var OlMap = function (_React$Component) {
2954
2962
  t.setVisiblePoints(mapVisiblePoints);
2955
2963
  }
2956
2964
  //设置中心点
2957
- if (typeof setCenter == 'boolean' && setCenter || setCenter && setCenter !== t.props.setCenter) {
2958
- if (!(t.getCurrentCenter().lng == mapCenter[0] && t.getCurrentCenter().lat == mapCenter[1])) {
2959
- t.setCenter(mapCenter);
2960
- }
2965
+ // if ((typeof (setCenter) == 'boolean' && setCenter) || (setCenter && setCenter !== t.props.setCenter)) {
2966
+ // if (!(t.getCurrentCenter().lng == mapCenter[0] && t.getCurrentCenter().lat == mapCenter[1])) {
2967
+ // t.setCenter(mapCenter);
2968
+ // }
2969
+ // }
2970
+ if (nextProps.mapCenter && nextProps.mapCenter.length > 0 && JSON.stringify(nextProps.mapCenter) !== JSON.stringify(this.props.mapCenter)) {
2971
+ t.setCenter(mapCenter);
2961
2972
  }
2962
2973
  //设置点聚合
2963
2974
  if (typeof setCluster == 'boolean' && setCluster || setCluster && setCluster !== t.props.setCluster) {
@@ -766,10 +766,9 @@ var VtxSearchMap = function (_React$Component) {
766
766
  clickGraphic: this.clickGraphic.bind(this),
767
767
  clickMap: function clickMap() {
768
768
  t.isClickMap = true;
769
- }
770
- }, drawProps, {
769
+ },
771
770
  olProps: olProps
772
- }))
771
+ }, drawProps))
773
772
  )
774
773
  )
775
774
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/map",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "@vtx/map",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {