@corpsmap/corpsmap 3.1.0 → 3.1.3

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/dev.js CHANGED
@@ -738,20 +738,21 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
738
738
  value: function componentDidMount() {
739
739
  var _this$props = this.props,
740
740
  doMapInitialize = _this$props.doMapInitialize,
741
- viewState = _this$props.viewState;
741
+ viewState = _this$props.viewState,
742
+ limitMapExtent = _this$props.limitMapExtent;
742
743
  var center = viewState.center,
743
744
  zoom = viewState.zoom,
744
745
  rotation = viewState.rotation,
745
746
  minZoom = viewState.minZoom,
746
747
  maxZoom = viewState.maxZoom;
747
- console.log(center);
748
748
  doMapInitialize(this.mapEl, {
749
749
  center: center,
750
750
  zoom: zoom,
751
751
  rotation: rotation,
752
752
  minZoom: minZoom,
753
753
  maxZoom: maxZoom,
754
- layers: []
754
+ layers: [],
755
+ limitMapExtent: limitMapExtent
755
756
  }); // doAddMapDragDropListeners(this.mapEl);
756
757
  }
757
758
  }, {
@@ -784,7 +785,7 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
784
785
  return Map;
785
786
  }(React$1__default.Component);
786
787
 
787
- var Map$2 = connect('doMapInitialize', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
788
+ var Map$2 = connect('doMapInitialize', 'selectLimitMapExtent', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
788
789
 
789
790
  var NorthRegion = /*#__PURE__*/function (_React$Component) {
790
791
  _inherits(NorthRegion, _React$Component);
@@ -4574,6 +4575,9 @@ var configBundle = {
4574
4575
  },
4575
4576
  selectDefaultLayers: function selectDefaultLayers(state) {
4576
4577
  return state.config["default"].datasets;
4578
+ },
4579
+ selectLimitMapExtent: function selectLimitMapExtent(state) {
4580
+ return state.config["default"].limitMapExtent;
4577
4581
  }
4578
4582
  };
4579
4583
 
@@ -65287,9 +65291,10 @@ function getXyzSource(options) {
65287
65291
  maxZoom: options.maxzoom,
65288
65292
  minZoom: options.minzoom,
65289
65293
  url: url,
65290
- crossOrigin: isCrossOrigin(options.url),
65291
- // CWBI-13636 Prevent horizontal wrapping.
65292
- wrapX: false
65294
+ crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
65295
+ // Line may no longer be needed.
65296
+ // wrapX: false,
65297
+
65293
65298
  });
65294
65299
  }
65295
65300
 
@@ -65383,8 +65388,9 @@ function getEsriVectorSource(options) {
65383
65388
  }
65384
65389
 
65385
65390
  function getTileLayer(options, source) {
65386
- // CWBI-13636 Prevent horizontal wrapping.
65387
- source.wrapX = false;
65391
+ // CWBI-13636 Prevent horizontal wrapping.
65392
+ // Line may no longer be needed.
65393
+ // source.wrapX = false;
65388
65394
  return new TileLayer({
65389
65395
  source: source,
65390
65396
  visible: options.visible,
@@ -65397,7 +65403,8 @@ function getTileLayer(options, source) {
65397
65403
 
65398
65404
  function getImageLayer(options, source) {
65399
65405
  // CWBI-13636 Prevent horizontal wrapping.
65400
- source.wrapX = false;
65406
+ // Line may no longer be needed.
65407
+ // source.wrapX = false;
65401
65408
  return new ImageLayer({
65402
65409
  source: source,
65403
65410
  visible: options.visible,
@@ -79004,7 +79011,8 @@ var createOlMapBundle = (function (opts) {
79004
79011
  rotation: 0,
79005
79012
  minZoom: 0,
79006
79013
  maxZoom: 22,
79007
- addons: {}
79014
+ addons: {},
79015
+ limitMapExtent: false
79008
79016
  };
79009
79017
  var config = Object.assign({}, defaults, opts);
79010
79018
  return Object.assign({}, {
@@ -79020,6 +79028,7 @@ var createOlMapBundle = (function (opts) {
79020
79028
  rotation: config.rotation,
79021
79029
  minZoom: config.minZoom,
79022
79030
  maxZoom: config.maxZoom,
79031
+ limitMapExtent: config.limitMapExtent,
79023
79032
  shouldInitialize: false,
79024
79033
  shouldResetViewState: false,
79025
79034
  shouldUpdateViewState: false
@@ -79056,21 +79065,26 @@ var createOlMapBundle = (function (opts) {
79056
79065
  var geoProjection = store.selectMapGeoProjection();
79057
79066
  var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
79058
79067
 
79059
- var extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection);
79068
+ var limitMapExtent = opts.hasOwnProperty("limitMapExtent") ? opts.limitMapExtent : null;
79069
+ var extent = limitMapExtent ? transformExtent([-180, -85, 180, 85], geoProjection, webProjection) : null;
79060
79070
  var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
79061
79071
  var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
79062
79072
  var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
79063
79073
  var minZoom = opts.hasOwnProperty("minZoom") ? opts.minZoom : store.selectMapMinZoom();
79064
79074
  var maxZoom = opts.hasOwnProperty("maxZoom") ? opts.maxZoom : store.selectMapMaxZoom();
79065
79075
  console.log("setting up at", opts.center, center);
79066
- var view = new View({
79076
+ var viewParams = {
79067
79077
  center: transform(center, geoProjection, webProjection),
79068
79078
  zoom: zoom,
79069
79079
  rotation: rotation,
79070
79080
  minZoom: minZoom,
79071
- maxZoom: maxZoom,
79072
- extent: extent
79073
- });
79081
+ maxZoom: maxZoom
79082
+ }; // CWBI-13636 Limit Map Extent
79083
+
79084
+ if (extent) {
79085
+ viewParams.extent = extent;
79086
+ }
79087
+ var view = new View(viewParams);
79074
79088
  var map = new Map$3({
79075
79089
  controls: [new ScaleLine({
79076
79090
  units: "us"
@@ -79180,6 +79194,12 @@ var createOlMapBundle = (function (opts) {
79180
79194
  });
79181
79195
  };
79182
79196
  },
79197
+ // doLimitMapExtent: (value) => ({ dispatch, store }) => {
79198
+ // dispatch({
79199
+ // type: "MAP_SET_LIMIT_EXTENT",
79200
+ // payload: { limitExtent: value, shouldResetViewState: true },
79201
+ // });
79202
+ // },
79183
79203
  selectMap: function selectMap(state) {
79184
79204
  return state.map.map;
79185
79205
  },
@@ -104869,7 +104889,9 @@ var mapViewBundle = {
104869
104889
  action: null,
104870
104890
  updating: false,
104871
104891
  listening: false,
104872
- shouldUpdateZoom: false
104892
+ shouldUpdateZoom: false // horse: true,
104893
+ // limitMapExtent: true,
104894
+
104873
104895
  };
104874
104896
  return function () {
104875
104897
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialData;
@@ -104941,7 +104963,8 @@ var mapViewBundle = {
104941
104963
  pitch: 0,
104942
104964
  roll: 0,
104943
104965
  minZoom: d.minzoom ? d.minzoom : 0,
104944
- maxZoom: d.maxzoom ? d.maxzoom : 22
104966
+ maxZoom: d.maxzoom ? d.maxzoom : 22 // limitMapExtent: d.limitMapExtent ? d.limitMapExtent : false,
104967
+
104945
104968
  };
104946
104969
  dispatch({
104947
104970
  type: "VIEW_SET_DEFAULTS",
@@ -106484,7 +106507,7 @@ var config = {
106484
106507
  };
106485
106508
 
106486
106509
  var name = "@corpsmap/corpsmap";
106487
- var version$1 = "3.1.0";
106510
+ var version$1 = "3.1.3";
106488
106511
  var description = "CorpsMap as React Components";
106489
106512
  var main = "index.js";
106490
106513
  var scripts = {
@@ -106637,7 +106660,8 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
106637
106660
  height = _this$props.height,
106638
106661
  theme = _this$props.theme,
106639
106662
  themeNavSize = _this$props.themeNavSize,
106640
- basemaps = _this$props.basemaps;
106663
+ basemaps = _this$props.basemaps,
106664
+ limitMapExtent = _this$props.limitMapExtent;
106641
106665
  cache.getAll().then(function (initialData) {
106642
106666
  initialData.config = {
106643
106667
  "default": Object.assign({}, config, mapConfig)
@@ -106665,6 +106689,10 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
106665
106689
  };
106666
106690
  }
106667
106691
 
106692
+ if (limitMapExtent) {
106693
+ initialData.config["default"].limitMapExtent = limitMapExtent;
106694
+ }
106695
+
106668
106696
  var store = getStore(initialData);
106669
106697
  loadPlugins(store, plugins);
106670
106698
  window.internalStore = store;
@@ -132759,6 +132787,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
132759
132787
  return attributes;
132760
132788
  };
132761
132789
 
132790
+ var formatArcgisVector = function formatArcgisVector(results) {
132791
+ results.map(function (feat) {
132792
+ for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
132793
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
132794
+ key = _Object$entries2$_i[0],
132795
+ value = _Object$entries2$_i[1];
132796
+
132797
+ var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
132798
+
132799
+ if (result) {
132800
+ feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132801
+ }
132802
+ } // results.properties = feat.properties;
132803
+
132804
+ });
132805
+ return results;
132806
+ };
132807
+
132808
+ var formatUtilities = {
132809
+ formatArcgisVector: formatArcgisVector,
132810
+ formatArcgisrest: formatArcgisrest
132811
+ };
132812
+
132762
132813
  function formatUrl(options) {
132763
132814
  var url = "".concat(options.root, "/identify?");
132764
132815
  var params = [];
@@ -132871,7 +132922,7 @@ var bundle$1 = {
132871
132922
  type: featureType,
132872
132923
  coordinates: coords
132873
132924
  },
132874
- properties: formatArcgisrest(feat.attributes)
132925
+ properties: formatUtilities(feat.attributes)
132875
132926
  };
132876
132927
  })
132877
132928
  })
@@ -162018,7 +162069,7 @@ var bundle$d = {
162018
162069
  err: null,
162019
162070
  result: _defineProperty({}, lyr.uid, {
162020
162071
  type: "FeatureCollection",
162021
- features: outFeatures
162072
+ features: formatUtilities.formatArcgisVector(outFeatures)
162022
162073
  })
162023
162074
  });
162024
162075
  }
package/lib/prod.js CHANGED
@@ -738,20 +738,21 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
738
738
  value: function componentDidMount() {
739
739
  var _this$props = this.props,
740
740
  doMapInitialize = _this$props.doMapInitialize,
741
- viewState = _this$props.viewState;
741
+ viewState = _this$props.viewState,
742
+ limitMapExtent = _this$props.limitMapExtent;
742
743
  var center = viewState.center,
743
744
  zoom = viewState.zoom,
744
745
  rotation = viewState.rotation,
745
746
  minZoom = viewState.minZoom,
746
747
  maxZoom = viewState.maxZoom;
747
- console.log(center);
748
748
  doMapInitialize(this.mapEl, {
749
749
  center: center,
750
750
  zoom: zoom,
751
751
  rotation: rotation,
752
752
  minZoom: minZoom,
753
753
  maxZoom: maxZoom,
754
- layers: []
754
+ layers: [],
755
+ limitMapExtent: limitMapExtent
755
756
  }); // doAddMapDragDropListeners(this.mapEl);
756
757
  }
757
758
  }, {
@@ -784,7 +785,7 @@ var Map$1 = /*#__PURE__*/function (_React$Component) {
784
785
  return Map;
785
786
  }(React$1__default.Component);
786
787
 
787
- var Map$2 = connect('doMapInitialize', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
788
+ var Map$2 = connect('doMapInitialize', 'selectLimitMapExtent', 'selectViewState', 'selectCursorClass', 'selectComponentsLeftSidebarCount', 'selectComponentsRightSidebarCount', Map$1);
788
789
 
789
790
  var NorthRegion = /*#__PURE__*/function (_React$Component) {
790
791
  _inherits(NorthRegion, _React$Component);
@@ -4488,6 +4489,9 @@ var configBundle = {
4488
4489
  },
4489
4490
  selectDefaultLayers: function selectDefaultLayers(state) {
4490
4491
  return state.config["default"].datasets;
4492
+ },
4493
+ selectLimitMapExtent: function selectLimitMapExtent(state) {
4494
+ return state.config["default"].limitMapExtent;
4491
4495
  }
4492
4496
  };
4493
4497
 
@@ -65201,9 +65205,10 @@ function getXyzSource(options) {
65201
65205
  maxZoom: options.maxzoom,
65202
65206
  minZoom: options.minzoom,
65203
65207
  url: url,
65204
- crossOrigin: isCrossOrigin(options.url),
65205
- // CWBI-13636 Prevent horizontal wrapping.
65206
- wrapX: false
65208
+ crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping.
65209
+ // Line may no longer be needed.
65210
+ // wrapX: false,
65211
+
65207
65212
  });
65208
65213
  }
65209
65214
 
@@ -65297,8 +65302,9 @@ function getEsriVectorSource(options) {
65297
65302
  }
65298
65303
 
65299
65304
  function getTileLayer(options, source) {
65300
- // CWBI-13636 Prevent horizontal wrapping.
65301
- source.wrapX = false;
65305
+ // CWBI-13636 Prevent horizontal wrapping.
65306
+ // Line may no longer be needed.
65307
+ // source.wrapX = false;
65302
65308
  return new TileLayer({
65303
65309
  source: source,
65304
65310
  visible: options.visible,
@@ -65311,7 +65317,8 @@ function getTileLayer(options, source) {
65311
65317
 
65312
65318
  function getImageLayer(options, source) {
65313
65319
  // CWBI-13636 Prevent horizontal wrapping.
65314
- source.wrapX = false;
65320
+ // Line may no longer be needed.
65321
+ // source.wrapX = false;
65315
65322
  return new ImageLayer({
65316
65323
  source: source,
65317
65324
  visible: options.visible,
@@ -78918,7 +78925,8 @@ var createOlMapBundle = (function (opts) {
78918
78925
  rotation: 0,
78919
78926
  minZoom: 0,
78920
78927
  maxZoom: 22,
78921
- addons: {}
78928
+ addons: {},
78929
+ limitMapExtent: false
78922
78930
  };
78923
78931
  var config = Object.assign({}, defaults, opts);
78924
78932
  return Object.assign({}, {
@@ -78934,6 +78942,7 @@ var createOlMapBundle = (function (opts) {
78934
78942
  rotation: config.rotation,
78935
78943
  minZoom: config.minZoom,
78936
78944
  maxZoom: config.maxZoom,
78945
+ limitMapExtent: config.limitMapExtent,
78937
78946
  shouldInitialize: false,
78938
78947
  shouldResetViewState: false,
78939
78948
  shouldUpdateViewState: false
@@ -78970,21 +78979,26 @@ var createOlMapBundle = (function (opts) {
78970
78979
  var geoProjection = store.selectMapGeoProjection();
78971
78980
  var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
78972
78981
 
78973
- var extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection);
78982
+ var limitMapExtent = opts.hasOwnProperty("limitMapExtent") ? opts.limitMapExtent : null;
78983
+ var extent = limitMapExtent ? transformExtent([-180, -85, 180, 85], geoProjection, webProjection) : null;
78974
78984
  var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
78975
78985
  var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
78976
78986
  var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
78977
78987
  var minZoom = opts.hasOwnProperty("minZoom") ? opts.minZoom : store.selectMapMinZoom();
78978
78988
  var maxZoom = opts.hasOwnProperty("maxZoom") ? opts.maxZoom : store.selectMapMaxZoom();
78979
78989
  console.log("setting up at", opts.center, center);
78980
- var view = new View({
78990
+ var viewParams = {
78981
78991
  center: transform(center, geoProjection, webProjection),
78982
78992
  zoom: zoom,
78983
78993
  rotation: rotation,
78984
78994
  minZoom: minZoom,
78985
- maxZoom: maxZoom,
78986
- extent: extent
78987
- });
78995
+ maxZoom: maxZoom
78996
+ }; // CWBI-13636 Limit Map Extent
78997
+
78998
+ if (extent) {
78999
+ viewParams.extent = extent;
79000
+ }
79001
+ var view = new View(viewParams);
78988
79002
  var map = new Map$3({
78989
79003
  controls: [new ScaleLine({
78990
79004
  units: "us"
@@ -79094,6 +79108,12 @@ var createOlMapBundle = (function (opts) {
79094
79108
  });
79095
79109
  };
79096
79110
  },
79111
+ // doLimitMapExtent: (value) => ({ dispatch, store }) => {
79112
+ // dispatch({
79113
+ // type: "MAP_SET_LIMIT_EXTENT",
79114
+ // payload: { limitExtent: value, shouldResetViewState: true },
79115
+ // });
79116
+ // },
79097
79117
  selectMap: function selectMap(state) {
79098
79118
  return state.map.map;
79099
79119
  },
@@ -104783,7 +104803,9 @@ var mapViewBundle = {
104783
104803
  action: null,
104784
104804
  updating: false,
104785
104805
  listening: false,
104786
- shouldUpdateZoom: false
104806
+ shouldUpdateZoom: false // horse: true,
104807
+ // limitMapExtent: true,
104808
+
104787
104809
  };
104788
104810
  return function () {
104789
104811
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialData;
@@ -104855,7 +104877,8 @@ var mapViewBundle = {
104855
104877
  pitch: 0,
104856
104878
  roll: 0,
104857
104879
  minZoom: d.minzoom ? d.minzoom : 0,
104858
- maxZoom: d.maxzoom ? d.maxzoom : 22
104880
+ maxZoom: d.maxzoom ? d.maxzoom : 22 // limitMapExtent: d.limitMapExtent ? d.limitMapExtent : false,
104881
+
104859
104882
  };
104860
104883
  dispatch({
104861
104884
  type: "VIEW_SET_DEFAULTS",
@@ -106398,7 +106421,7 @@ var config = {
106398
106421
  };
106399
106422
 
106400
106423
  var name = "@corpsmap/corpsmap";
106401
- var version$1 = "3.1.0";
106424
+ var version$1 = "3.1.3";
106402
106425
  var description = "CorpsMap as React Components";
106403
106426
  var main = "index.js";
106404
106427
  var scripts = {
@@ -106551,7 +106574,8 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
106551
106574
  height = _this$props.height,
106552
106575
  theme = _this$props.theme,
106553
106576
  themeNavSize = _this$props.themeNavSize,
106554
- basemaps = _this$props.basemaps;
106577
+ basemaps = _this$props.basemaps,
106578
+ limitMapExtent = _this$props.limitMapExtent;
106555
106579
  cache.getAll().then(function (initialData) {
106556
106580
  initialData.config = {
106557
106581
  "default": Object.assign({}, config, mapConfig)
@@ -106579,6 +106603,10 @@ var Map$4 = /*#__PURE__*/function (_React$Component) {
106579
106603
  };
106580
106604
  }
106581
106605
 
106606
+ if (limitMapExtent) {
106607
+ initialData.config["default"].limitMapExtent = limitMapExtent;
106608
+ }
106609
+
106582
106610
  var store = getStore(initialData);
106583
106611
  loadPlugins(store, plugins);
106584
106612
  window.internalStore = store;
@@ -132673,6 +132701,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
132673
132701
  return attributes;
132674
132702
  };
132675
132703
 
132704
+ var formatArcgisVector = function formatArcgisVector(results) {
132705
+ results.map(function (feat) {
132706
+ for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
132707
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
132708
+ key = _Object$entries2$_i[0],
132709
+ value = _Object$entries2$_i[1];
132710
+
132711
+ var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
132712
+
132713
+ if (result) {
132714
+ feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132715
+ }
132716
+ } // results.properties = feat.properties;
132717
+
132718
+ });
132719
+ return results;
132720
+ };
132721
+
132722
+ var formatUtilities = {
132723
+ formatArcgisVector: formatArcgisVector,
132724
+ formatArcgisrest: formatArcgisrest
132725
+ };
132726
+
132676
132727
  function formatUrl(options) {
132677
132728
  var url = "".concat(options.root, "/identify?");
132678
132729
  var params = [];
@@ -132785,7 +132836,7 @@ var bundle$1 = {
132785
132836
  type: featureType,
132786
132837
  coordinates: coords
132787
132838
  },
132788
- properties: formatArcgisrest(feat.attributes)
132839
+ properties: formatUtilities(feat.attributes)
132789
132840
  };
132790
132841
  })
132791
132842
  })
@@ -161932,7 +161983,7 @@ var bundle$d = {
161932
161983
  err: null,
161933
161984
  result: _defineProperty({}, lyr.uid, {
161934
161985
  type: "FeatureCollection",
161935
- features: outFeatures
161986
+ features: formatUtilities.formatArcgisVector(outFeatures)
161936
161987
  })
161937
161988
  });
161938
161989
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpsmap/corpsmap",
3
- "version": "3.1.0",
3
+ "version": "3.1.3",
4
4
  "description": "CorpsMap as React Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,7 +6,6 @@ export default {
6
6
  const initialData = {
7
7
  default:{}
8
8
  }
9
-
10
9
  return (state = initialData, { type, payload }) => {
11
10
  return state;
12
11
  }
@@ -26,5 +25,10 @@ export default {
26
25
 
27
26
  selectDefaultLayers: (state) => {
28
27
  return state.config.default.datasets;
28
+ },
29
+
30
+ selectLimitMapExtent: (state) => {
31
+ return state.config.default.limitMapExtent;
29
32
  }
33
+
30
34
  }
@@ -16,8 +16,9 @@ export default (opts) => {
16
16
  minZoom: 0,
17
17
  maxZoom: 22,
18
18
  addons: {},
19
+ limitMapExtent: false,
19
20
  };
20
-
21
+
21
22
  const config = Object.assign({}, defaults, opts);
22
23
 
23
24
  return Object.assign(
@@ -36,6 +37,7 @@ export default (opts) => {
36
37
  rotation: config.rotation,
37
38
  minZoom: config.minZoom,
38
39
  maxZoom: config.maxZoom,
40
+ limitMapExtent: config.limitMapExtent,
39
41
  shouldInitialize: false,
40
42
  shouldResetViewState: false,
41
43
  shouldUpdateViewState: false,
@@ -64,7 +66,12 @@ export default (opts) => {
64
66
  const geoProjection = store.selectMapGeoProjection();
65
67
  const webProjection = store.selectMapWebProjection();
66
68
  // CWBI-13636 Limit Map Extent
67
- const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
69
+ const limitMapExtent = opts.hasOwnProperty("limitMapExtent")
70
+ ? opts.limitMapExtent
71
+ : null;
72
+ const extent = limitMapExtent
73
+ ? transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
74
+ : null;
68
75
  const center = opts.hasOwnProperty("center")
69
76
  ? opts.center
70
77
  : store.selectMapCenter();
@@ -81,16 +88,21 @@ export default (opts) => {
81
88
  ? opts.maxZoom
82
89
  : store.selectMapMaxZoom();
83
90
 
91
+
84
92
  console.log("setting up at", opts.center, center);
85
93
 
86
- const view = new View({
94
+ const viewParams = {
87
95
  center: transform(center, geoProjection, webProjection),
88
96
  zoom: zoom,
89
97
  rotation: rotation,
90
98
  minZoom: minZoom,
91
99
  maxZoom: maxZoom,
92
- extent: extent,
93
- });
100
+ };
101
+
102
+ // CWBI-13636 Limit Map Extent
103
+ if (extent) { viewParams.extent = extent };
104
+
105
+ const view = new View(viewParams);
94
106
 
95
107
  const map = new olMap({
96
108
  controls: [new ScaleBar({ units: "us" })],
@@ -168,7 +180,7 @@ export default (opts) => {
168
180
  200
169
181
  );
170
182
  },
171
-
183
+
172
184
  doMapZoomTo: (lonLat, z) => ({ store }) => {
173
185
  const map = store.selectMap();
174
186
  const view = map.getView();
@@ -178,6 +190,13 @@ export default (opts) => {
178
190
  });
179
191
  },
180
192
 
193
+ // doLimitMapExtent: (value) => ({ dispatch, store }) => {
194
+ // dispatch({
195
+ // type: "MAP_SET_LIMIT_EXTENT",
196
+ // payload: { limitExtent: value, shouldResetViewState: true },
197
+ // });
198
+ // },
199
+
181
200
  selectMap: (state) => {
182
201
  return state.map.map;
183
202
  },