@corpsmap/corpsmap 3.1.1 → 3.1.4

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.1";
106510
+ var version$1 = "3.1.4";
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;
@@ -132771,17 +132799,11 @@ var formatArcgisVector = function formatArcgisVector(results) {
132771
132799
  if (result) {
132772
132800
  feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132773
132801
  }
132774
- } // results.properties = feat.properties;
132775
-
132802
+ }
132776
132803
  });
132777
132804
  return results;
132778
132805
  };
132779
132806
 
132780
- var formatUtilities = {
132781
- formatArcgisVector: formatArcgisVector,
132782
- formatArcgisrest: formatArcgisrest
132783
- };
132784
-
132785
132807
  function formatUrl(options) {
132786
132808
  var url = "".concat(options.root, "/identify?");
132787
132809
  var params = [];
@@ -132894,7 +132916,7 @@ var bundle$1 = {
132894
132916
  type: featureType,
132895
132917
  coordinates: coords
132896
132918
  },
132897
- properties: formatUtilities(feat.attributes)
132919
+ properties: formatArcgisrest(feat.attributes)
132898
132920
  };
132899
132921
  })
132900
132922
  })
@@ -142784,7 +142806,7 @@ var ArcGisListener = {
142784
142806
  type: featGeometry.getType(),
142785
142807
  coordinates: featGeometry.getCoordinates()
142786
142808
  },
142787
- properties: feat.attributes
142809
+ properties: formatArcgisrest(feat.attributes)
142788
142810
  };
142789
142811
  })
142790
142812
  })
@@ -142887,7 +142909,7 @@ var VectorListener = {
142887
142909
  err: null,
142888
142910
  result: _defineProperty({}, lyr.uid, {
142889
142911
  type: "FeatureCollection",
142890
- features: outFeatures
142912
+ features: formatArcgisVector(outFeatures)
142891
142913
  })
142892
142914
  });
142893
142915
  }
@@ -160591,7 +160613,10 @@ var bundle$a = {
160591
160613
  ctx.fillStyle = "white";
160592
160614
  ctx.fillRect(0, 0, canvas.width, canvas.height);
160593
160615
  ctx.drawImage(mapCanvas, 0, 0);
160594
- ctx.drawImage(legendCanvas, mapCanvas.width, 0); //draw legend to the right of mapCanvas
160616
+
160617
+ if (legendCanvas.height !== 0 && legendCanvas.width !== 0) {
160618
+ ctx.drawImage(legendCanvas, mapCanvas.width, 0); //draw legend to the right of mapCanvas
160619
+ }
160595
160620
 
160596
160621
  print.download = "map.png";
160597
160622
  print.href = canvas.toDataURL();
@@ -162041,7 +162066,7 @@ var bundle$d = {
162041
162066
  err: null,
162042
162067
  result: _defineProperty({}, lyr.uid, {
162043
162068
  type: "FeatureCollection",
162044
- features: formatUtilities.formatArcgisVector(outFeatures)
162069
+ features: formatArcgisVector(outFeatures)
162045
162070
  })
162046
162071
  });
162047
162072
  }
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.1";
106424
+ var version$1 = "3.1.4";
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;
@@ -132685,17 +132713,11 @@ var formatArcgisVector = function formatArcgisVector(results) {
132685
132713
  if (result) {
132686
132714
  feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132687
132715
  }
132688
- } // results.properties = feat.properties;
132689
-
132716
+ }
132690
132717
  });
132691
132718
  return results;
132692
132719
  };
132693
132720
 
132694
- var formatUtilities = {
132695
- formatArcgisVector: formatArcgisVector,
132696
- formatArcgisrest: formatArcgisrest
132697
- };
132698
-
132699
132721
  function formatUrl(options) {
132700
132722
  var url = "".concat(options.root, "/identify?");
132701
132723
  var params = [];
@@ -132808,7 +132830,7 @@ var bundle$1 = {
132808
132830
  type: featureType,
132809
132831
  coordinates: coords
132810
132832
  },
132811
- properties: formatUtilities(feat.attributes)
132833
+ properties: formatArcgisrest(feat.attributes)
132812
132834
  };
132813
132835
  })
132814
132836
  })
@@ -142698,7 +142720,7 @@ var ArcGisListener = {
142698
142720
  type: featGeometry.getType(),
142699
142721
  coordinates: featGeometry.getCoordinates()
142700
142722
  },
142701
- properties: feat.attributes
142723
+ properties: formatArcgisrest(feat.attributes)
142702
142724
  };
142703
142725
  })
142704
142726
  })
@@ -142801,7 +142823,7 @@ var VectorListener = {
142801
142823
  err: null,
142802
142824
  result: _defineProperty({}, lyr.uid, {
142803
142825
  type: "FeatureCollection",
142804
- features: outFeatures
142826
+ features: formatArcgisVector(outFeatures)
142805
142827
  })
142806
142828
  });
142807
142829
  }
@@ -160505,7 +160527,10 @@ var bundle$a = {
160505
160527
  ctx.fillStyle = "white";
160506
160528
  ctx.fillRect(0, 0, canvas.width, canvas.height);
160507
160529
  ctx.drawImage(mapCanvas, 0, 0);
160508
- ctx.drawImage(legendCanvas, mapCanvas.width, 0); //draw legend to the right of mapCanvas
160530
+
160531
+ if (legendCanvas.height !== 0 && legendCanvas.width !== 0) {
160532
+ ctx.drawImage(legendCanvas, mapCanvas.width, 0); //draw legend to the right of mapCanvas
160533
+ }
160509
160534
 
160510
160535
  print.download = "map.png";
160511
160536
  print.href = canvas.toDataURL();
@@ -161955,7 +161980,7 @@ var bundle$d = {
161955
161980
  err: null,
161956
161981
  result: _defineProperty({}, lyr.uid, {
161957
161982
  type: "FeatureCollection",
161958
- features: formatUtilities.formatArcgisVector(outFeatures)
161983
+ features: formatArcgisVector(outFeatures)
161959
161984
  })
161960
161985
  });
161961
161986
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpsmap/corpsmap",
3
- "version": "3.1.1",
3
+ "version": "3.1.4",
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
  },