geojs 1.5.0 → 1.6.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +5 -6
  2. package/geo.js +79182 -82989
  3. package/geo.lean.js +70339 -64724
  4. package/geo.lean.min.js +28 -41
  5. package/geo.min.js +30 -47
  6. package/package.json +61 -74
  7. package/src/annotationLayer.js +13 -13
  8. package/src/canvas/heatmapFeature.js +2 -2
  9. package/src/choroplethFeature.js +3 -3
  10. package/src/feature.js +4 -4
  11. package/src/geojsonReader.js +5 -4
  12. package/src/index.js +1 -1
  13. package/src/isolineFeature.js +4 -4
  14. package/src/lineFeature.js +4 -4
  15. package/src/map.js +2 -2
  16. package/src/mapInteractor.js +3 -0
  17. package/src/markerFeature.js +8 -8
  18. package/src/object.js +1 -3
  19. package/src/osmLayer.js +3 -3
  20. package/src/pixelmapFeature.js +1 -1
  21. package/src/pointFeature.js +1 -1
  22. package/src/polygonFeature.js +4 -4
  23. package/src/registry.js +1 -1
  24. package/src/svg/svgRenderer.js +3 -0
  25. package/src/svg/vectorFeature.js +1 -1
  26. package/src/tileLayer.js +4 -4
  27. package/src/trackFeature.js +12 -12
  28. package/src/transform.js +11 -10
  29. package/src/ui/colorLegendWidget.js +6 -6
  30. package/src/ui/legendWidget.js +3 -3
  31. package/src/ui/sliderWidget.js +4 -4
  32. package/src/util/common.js +9 -8
  33. package/src/util/mockVGL.js +2 -2
  34. package/src/util/throttle.js +3 -3
  35. package/src/vendor.js +0 -2
  36. package/src/vtkjs/vtkjsRenderer.js +3 -0
  37. package/src/webgl/layer.js +1 -1
  38. package/src/webgl/markerFeature.js +4 -4
  39. package/src/webgl/meshColored.js +3 -3
  40. package/src/webgl/pointFeature.js +11 -11
  41. package/src/webgl/polygonFeature.js +3 -3
  42. package/src/webgl/webglRenderer.js +1 -2
  43. package/src/polyfills.js +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geojs",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -13,15 +13,15 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "color-name": "^1.1.4",
16
- "earcut": "^2.2.2",
16
+ "earcut": "^2.2.3",
17
17
  "gl-mat3": "^2.0.0",
18
18
  "gl-mat4": "^1.2.0",
19
19
  "gl-vec3": "^1.1.3",
20
20
  "gl-vec4": "^1.0.1",
21
- "jquery": "^3.5.1",
21
+ "jquery": "^3.6.0",
22
22
  "kdbush": "^3.0.0",
23
23
  "mousetrap": "^1.6.5",
24
- "proj4": "2.6.0",
24
+ "proj4": "^2.7.5",
25
25
  "vgl": "0.3.11"
26
26
  },
27
27
  "optionalDependencies": {
@@ -30,90 +30,77 @@
30
30
  "vtk.js": "^14.3.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@semantic-release/changelog": "^5.0.1",
34
- "babel-core": "^6.26.3",
35
- "babel-loader": "^7.1.5",
36
- "babel-plugin-istanbul": "^4.1.6",
37
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
38
- "babel-polyfill": "^6.26.0",
39
- "babel-preset-env": "^1.7.0",
33
+ "@babel/core": "^7.16.5",
34
+ "@babel/plugin-proposal-class-properties": "^7.16.5",
35
+ "@babel/preset-env": "^7.16.5",
36
+ "babel-loader": "^8.2.3",
37
+ "babel-plugin-istanbul": "^6.1.1",
40
38
  "bootstrap": "^3.4.1",
41
39
  "bootswatch": "^3.4.1",
42
- "codemirror": "^5.54.0",
43
- "colorbrewer": "1.3.0",
44
- "css-loader": "^0.28.11",
45
- "docco": "^0.7.0",
46
- "eslint": "^5.16.0",
47
- "eslint-config-semistandard": "^13.0.0",
48
- "eslint-config-standard": "^12.0.0",
49
- "eslint-plugin-import": "^2.20.2",
50
- "eslint-plugin-node": "^7.0.1",
51
- "eslint-plugin-promise": "^4.2.1",
52
- "eslint-plugin-standard": "^4.0.1",
53
- "expose-loader": "^0.7.5",
54
- "express": "^4.17.1",
55
- "file-loader": "^2.0.0",
56
- "forever": "^0.15.2",
57
- "fs-extra": "^7.0.0",
58
- "glob": "^7.1.6",
40
+ "codemirror": "^5.65.0",
41
+ "colorbrewer": "^1.5.1",
42
+ "css-loader": "^6.5.1",
43
+ "docco": "^0.9.1",
44
+ "eslint": "^8.5.0",
45
+ "eslint-config-semistandard": "^16.0.0",
46
+ "eslint-config-standard": "^16.0.3",
47
+ "eslint-plugin-import": "^2.25.3",
48
+ "eslint-plugin-node": "^11.1.0",
49
+ "eslint-plugin-promise": "^6.0.0",
50
+ "eslint-plugin-standard": "^5.0.0",
51
+ "expose-loader": "^3.1.0",
52
+ "express": "^4.17.2",
53
+ "forever": "^4.0.1",
54
+ "fs-extra": "^10.0.0",
55
+ "glob": "^7.2.0",
59
56
  "glslang-validator-prebuilt": "0.0.6",
60
- "imports-loader": "^0.8.0",
57
+ "imports-loader": "^3.1.1",
61
58
  "istanbul-combine": "^0.3.0",
62
59
  "istanbul-instrumenter-loader": "^3.0.1",
63
60
  "jaguarjs-jsdoc": "^1.0.2",
64
- "jasmine-core": "^3.5.0",
65
- "js-yaml": "^3.14.0",
66
- "jsdoc": "^3.6.4",
61
+ "jasmine-core": "^4.0.0",
62
+ "js-yaml": "^4.1.0",
63
+ "jsdoc": "^3.6.7",
67
64
  "jsdoc-autoprivate": "0.0.1",
68
- "jsonlint-mod": "^1.7.5",
65
+ "jsonlint-mod": "^1.7.6",
69
66
  "jstransformer-markdown-it": "^2.0.0",
70
- "karma": "^3.1.1",
71
- "karma-chrome-launcher": "^2.2.0",
72
- "karma-coverage": "^1.1.2",
73
- "karma-firefox-launcher": "^1.3.0",
74
- "karma-jasmine": "^2.0.0",
75
- "karma-jasmine-html-reporter": "^1.5.4",
76
- "karma-phantomjs-launcher": "^1.0.0",
77
- "karma-phantomjs-shim": "^1.5.0",
78
- "karma-sinon": "^1.0.4",
79
- "karma-sourcemap-loader": "^0.3.7",
67
+ "karma": "^6.3.9",
68
+ "karma-chrome-launcher": "^3.1.0",
69
+ "karma-coverage": "^2.1.0",
70
+ "karma-firefox-launcher": "^2.1.2",
71
+ "karma-jasmine": "^4.0.1",
72
+ "karma-jasmine-html-reporter": "^1.7.0",
73
+ "karma-sinon": "^1.0.5",
74
+ "karma-sourcemap-loader": "^0.3.8",
80
75
  "karma-spec-reporter": "^0.0.32",
81
- "karma-webpack": "^3.0.5",
76
+ "karma-webpack": "^5.0.0",
82
77
  "nib": "^1.1.2",
83
- "pako": "^1.0.11",
84
- "phantomjs-prebuilt": "^2.1.5",
85
- "pug": "^3.0.1",
86
- "pug-lint": "^2.4.0",
78
+ "pako": "^2.0.4",
79
+ "pug": "^3.0.2",
80
+ "pug-lint": "^2.6.0",
87
81
  "pug-load": "^3.0.0",
88
- "raw-body": "^2.1.6",
89
- "resemblejs": "^3.2.4",
90
- "semantic-release": "^17.4.3",
82
+ "raw-body": "^2.4.2",
83
+ "resemblejs": "^4.0.0",
84
+ "semantic-release": "^18.0.0",
91
85
  "serve-index": "^1.9.1",
92
86
  "shader-loader": "^1.3.1",
93
- "sinon": "^1.17.7",
87
+ "sinon": "^12.0.1",
94
88
  "string-replace-webpack-plugin": "^0.1.3",
95
- "style-loader": "^0.23.1",
96
- "stylus": "^0.54.7",
97
- "stylus-loader": "^3.0.2",
89
+ "style-loader": "^3.3.1",
90
+ "stylus": "^0.56.0",
91
+ "stylus-loader": "^6.2.0",
92
+ "terser-webpack-plugin": "^5.3.0",
98
93
  "touch-emulator": "^1.0.0",
99
- "typeface-lato": "^0.0.75",
100
- "uglifyjs-webpack-plugin": "^1.2.5",
101
- "url-loader": "^1.1.2",
102
- "webpack": "^3.12.0",
103
- "webpack-merge": "^4.2.2"
94
+ "typeface-lato": "^1.1.13",
95
+ "webpack": "^5.65.0",
96
+ "webpack-cli": "^4.9.1",
97
+ "webpack-merge": "^5.8.0"
104
98
  },
105
99
  "release": {
106
100
  "plugins": [
107
101
  "@semantic-release/commit-analyzer",
108
102
  "@semantic-release/release-notes-generator",
109
103
  "@semantic-release/npm",
110
- [
111
- "@semantic-release/changelog",
112
- {
113
- "changelogFile": "CHANGELOG.md",
114
- "changelogTitle": "# GeoJS Change Log"
115
- }
116
- ],
117
104
  [
118
105
  "@semantic-release/github",
119
106
  {
@@ -148,20 +135,20 @@
148
135
  "lint": "eslint --cache . --max-warnings=0",
149
136
  "puglint": "pug-lint src examples",
150
137
  "glsllint": "find . \\( -name '*.frag' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S frag || exit 1; done' sh {} \\+ && find . \\( -name '*.vert' \\) -exec sh -c 'for n; do python scripts/preprocess_glsl.py \"$n\" | node_modules/glslang-validator-prebuilt/bin/glslangValidator --stdin -S vert || exit 1; done' sh {} \\+",
151
- "test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
152
- "test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
138
+ "test-headless": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
139
+ "test-headless-all": "GEOJS_TEST_CASE=tests/test-unit.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
153
140
  "test-headed": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull",
154
141
  "tets-headed-all": "GEOJS_TEST_CASE=tests/test-headed.js karma start karma-cov.conf.js --single-run --browsers ChromeFull,FirefoxWithProxy",
155
142
  "test-headed-xvfb": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeFull",
156
143
  "test-webglheadless": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
157
144
  "test-webglheadless-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
158
- "test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,PhantomJS",
159
- "test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
145
+ "test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
146
+ "test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
160
147
  "get-data-files": "node scripts/datastore.js dist/data",
161
148
  "ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
162
149
  "ci": "npm run ci-build && npm run ci-test",
163
- "ci-build": "(webpack --config webpack.config.js & webpack --config webpack-lean.config.js & npm run docs & npm run get-data-files & npm run lint & npm run puglint & npm run glsllint & npm run build-examples & npm run build-tutorials & wait)",
164
- "ci-test": "npm run test-headless && npm run test-headed && npm run test-webglheadless && npm run test-tutorials && npm run combine-coverage",
150
+ "ci-build": "bash -c '(webpack --config webpack.config.js & webpack --config webpack-lean.config.js & npm run docs & npm run get-data-files & npm run lint & npm run puglint & npm run glsllint & npm run build-examples & npm run build-tutorials & wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n && wait -n)'",
151
+ "ci-test": "npm run test-headless && npm run test-webglheadless && npm run test-headed && npm run test-tutorials && npm run combine-coverage",
165
152
  "ci-xvfb": "npm run ci-clean && npm run ci-build && TEST_SAVE_IMAGE='all' xvfb-run -s '-ac -screen 0 1280x1024x24' npm run ci-test",
166
153
  "start": "karma start karma.conf.js",
167
154
  "combine-coverage": "istanbul-combine -d dist/cobertura -r cobertura 'dist/coverage/json/**/coverage-final.json'",
@@ -172,7 +159,7 @@
172
159
  "website": "cd website && npx hexo server",
173
160
  "setup-website": "cd website && npm install",
174
161
  "build-website": "npm run ci-build && npm run ci-build-website",
175
- "ci-build-website": "cp -a dist/built/. website/source/built && (npm run build-website-examples & npm run build-website-tutorials & wait) && cd dist && find data \\( -name tiles -o -name base-images -o -name '*-hash-stamp' -o -name '*.tgz' \\) -prune -o \\( -print0 \\) | cpio -pmdL0 ../website/source && cp -ar apidocs/. ../website/source/apidocs && cd ../website && npm install && rm -f db.json && npx hexo generate",
162
+ "ci-build-website": "cp -a dist/built/. website/source/built && bash -c '(npm run build-website-examples & npm run build-website-tutorials & wait -n && wait -n)' && cd dist && find data \\( -name tiles -o -name base-images -o -name '*-hash-stamp' -o -name '*.tgz' \\) -prune -o \\( -print0 \\) | cpio -pmdL0 ../website/source && cp -ar apidocs/. ../website/source/apidocs && cd ../website && npm install && rm -f db.json && npx hexo generate",
176
163
  "prepublishOnly": "webpack --config webpack.config.js && webpack --config webpack-lean.config.js && cp dist/built/*.js .",
177
164
  "semantic-release": "semantic-release"
178
165
  },
@@ -91,19 +91,19 @@ var annotationLayer = function (arg) {
91
91
  m_keyHandler;
92
92
 
93
93
  var geojsonStyleProperties = {
94
- 'closed': {dataType: 'boolean', keys: ['closed', 'close']},
95
- 'fill': {dataType: 'boolean', keys: ['fill']},
96
- 'fillColor': {dataType: 'color', keys: ['fillColor', 'fill-color', 'marker-color', 'fill']},
97
- 'fillOpacity': {dataType: 'opacity', keys: ['fillOpacity', 'fill-opacity']},
98
- 'lineCap': {dataType: 'text', keys: ['lineCap', 'line-cap']},
99
- 'lineJoin': {dataType: 'text', keys: ['lineJoin', 'line-join']},
100
- 'radius': {dataType: 'positive', keys: ['radius']},
101
- 'scaled': {dataType: 'booleanOrNumber', keys: ['scaled']},
102
- 'stroke': {dataType: 'boolean', keys: ['stroke']},
103
- 'strokeColor': {dataType: 'color', keys: ['strokeColor', 'stroke-color', 'stroke']},
104
- 'strokeOffset': {dataType: 'number', keys: ['strokeOffset', 'stroke-offset']},
105
- 'strokeOpacity': {dataType: 'opacity', keys: ['strokeOpacity', 'stroke-opacity']},
106
- 'strokeWidth': {dataType: 'positive', keys: ['strokeWidth', 'stroke-width']}
94
+ closed: {dataType: 'boolean', keys: ['closed', 'close']},
95
+ fill: {dataType: 'boolean', keys: ['fill']},
96
+ fillColor: {dataType: 'color', keys: ['fillColor', 'fill-color', 'marker-color', 'fill']},
97
+ fillOpacity: {dataType: 'opacity', keys: ['fillOpacity', 'fill-opacity']},
98
+ lineCap: {dataType: 'text', keys: ['lineCap', 'line-cap']},
99
+ lineJoin: {dataType: 'text', keys: ['lineJoin', 'line-join']},
100
+ radius: {dataType: 'positive', keys: ['radius']},
101
+ scaled: {dataType: 'booleanOrNumber', keys: ['scaled']},
102
+ stroke: {dataType: 'boolean', keys: ['stroke']},
103
+ strokeColor: {dataType: 'color', keys: ['strokeColor', 'stroke-color', 'stroke']},
104
+ strokeOffset: {dataType: 'number', keys: ['strokeOffset', 'stroke-offset']},
105
+ strokeOpacity: {dataType: 'opacity', keys: ['strokeOpacity', 'stroke-opacity']},
106
+ strokeWidth: {dataType: 'positive', keys: ['strokeWidth', 'stroke-width']}
107
107
  };
108
108
  var textFeatureDataTypes = {
109
109
  offset: 'coordinate2',
@@ -84,7 +84,7 @@ var canvas_heatmapFeature = function (arg) {
84
84
  gaussian = m_this.style('gaussian');
85
85
  scale = m_this.style('scaleWithZoom');
86
86
  if (scale) {
87
- let zoom = this.layer().map().zoom();
87
+ const zoom = this.layer().map().zoom();
88
88
  scale = Math.pow(2, zoom);
89
89
  r *= scale;
90
90
  blur *= scale;
@@ -306,7 +306,7 @@ var canvas_heatmapFeature = function (arg) {
306
306
  this._renderOnCanvas = function (context2d, map) {
307
307
 
308
308
  if (m_renderTime.timestamp() < m_this.buildTime().timestamp()) {
309
- let starttime = Date.now();
309
+ const starttime = Date.now();
310
310
  var data = m_this.data() || [],
311
311
  radius = m_this.style('radius') + m_this.style('blurRadius'),
312
312
  binned = m_this.binned(),
@@ -209,8 +209,8 @@ var choroplethFeature = function (arg) {
209
209
  newFeature
210
210
  .polygon(function (d) {
211
211
  return {
212
- 'outer': d.coordinates[0],
213
- 'inner': d.coordinates[1] // undefined but ok
212
+ outer: d.coordinates[0],
213
+ inner: d.coordinates[1] // undefined but ok
214
214
  };
215
215
  })
216
216
  .position(function (d) {
@@ -220,7 +220,7 @@ var choroplethFeature = function (arg) {
220
220
  };
221
221
  })
222
222
  .style({
223
- 'fillColor': fillColor
223
+ fillColor: fillColor
224
224
  });
225
225
 
226
226
  return newFeature;
package/src/feature.js CHANGED
@@ -423,10 +423,10 @@ var feature = function (arg) {
423
423
  this._handleBrush = function (brush) {
424
424
  let corners = [brush.gcs.lowerLeft, brush.gcs.lowerRight, brush.gcs.upperRight, brush.gcs.upperLeft];
425
425
  if (m_this.layer()) {
426
- let map = m_this.layer().map();
426
+ const map = m_this.layer().map();
427
427
  corners = transform.transformCoordinates(map.gcs(), map.ingcs(), corners);
428
428
  }
429
- let search = m_this.polygonSearch(corners);
429
+ const search = m_this.polygonSearch(corners);
430
430
 
431
431
  feature.eventID += 1;
432
432
  search.index.forEach(function (idx, i) {
@@ -451,10 +451,10 @@ var feature = function (arg) {
451
451
  this._handleBrushend = function (brush) {
452
452
  let corners = [brush.gcs.lowerLeft, brush.gcs.lowerRight, brush.gcs.upperRight, brush.gcs.upperLeft];
453
453
  if (m_this.layer()) {
454
- let map = m_this.layer().map();
454
+ const map = m_this.layer().map();
455
455
  corners = transform.transformCoordinates(map.gcs(), map.ingcs(), corners);
456
456
  }
457
- let search = m_this.polygonSearch(corners);
457
+ const search = m_this.polygonSearch(corners);
458
458
 
459
459
  feature.eventID += 1;
460
460
  search.index.forEach(function (idx, i) {
@@ -324,7 +324,8 @@ var geojsonReader = function (arg) {
324
324
  reject(new Error('Failed to parse GeoJSON'));
325
325
  return;
326
326
  }
327
- let features, allFeatures = [], points, lines, polygons, feature;
327
+ let features, feature;
328
+ const allFeatures = [];
328
329
 
329
330
  try {
330
331
  features = m_this._featureArray(object);
@@ -334,7 +335,7 @@ var geojsonReader = function (arg) {
334
335
  }
335
336
 
336
337
  // process points
337
- points = features.filter(f => f.geometry.type === 'Point');
338
+ const points = features.filter(f => f.geometry.type === 'Point');
338
339
  if (points.length) {
339
340
  feature = m_this.layer().createFeature('point');
340
341
  if (feature) {
@@ -358,7 +359,7 @@ var geojsonReader = function (arg) {
358
359
  }
359
360
 
360
361
  // process lines
361
- lines = features.filter(f => f.geometry.type === 'LineString');
362
+ const lines = features.filter(f => f.geometry.type === 'LineString');
362
363
  if (lines.length) {
363
364
  feature = m_this.layer().createFeature('line');
364
365
  if (feature) {
@@ -383,7 +384,7 @@ var geojsonReader = function (arg) {
383
384
  }
384
385
 
385
386
  // process polygons
386
- polygons = features.filter(f => f.geometry.type === 'Polygon');
387
+ const polygons = features.filter(f => f.geometry.type === 'Polygon');
387
388
  if (polygons.length) {
388
389
  feature = m_this.layer().createFeature('polygon');
389
390
  if (feature) {
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // License headers that will be preserved in distributed bundles.
2
2
  /**
3
3
  * GeoJS
4
- * @copyright 2013-2018, Kitware, Inc.
4
+ * @copyright 2013-2022, Kitware, Inc.
5
5
  * @license Apache-2.0
6
6
  * @namespace geo
7
7
  */
@@ -872,13 +872,13 @@ var isolineFeature = function (arg) {
872
872
  */
873
873
  isolineFeature.rotationFunction = function (mode, map) {
874
874
  var functionList = {
875
- 'higher': function (d) {
875
+ higher: function (d) {
876
876
  return d.rotation;
877
877
  },
878
- 'lower': function (d) {
878
+ lower: function (d) {
879
879
  return d.rotation + Math.PI;
880
880
  },
881
- 'map': function (d) {
881
+ map: function (d) {
882
882
  var r = d.rotation,
883
883
  rt = util.wrapAngle(r, true);
884
884
  if (rt > Math.PI / 2 || rt < -Math.PI / 2) {
@@ -886,7 +886,7 @@ isolineFeature.rotationFunction = function (mode, map) {
886
886
  }
887
887
  return r;
888
888
  },
889
- 'screen': function (d) {
889
+ screen: function (d) {
890
890
  var r = d.rotation,
891
891
  rt = util.wrapAngle(r + map.rotation(), true);
892
892
  if (rt > Math.PI / 2 || rt < -Math.PI / 2) {
@@ -313,8 +313,8 @@ var lineFeature = function (arg) {
313
313
  if (p.y > max.y) { max.y = p.y; }
314
314
  });
315
315
  m_this._updatePointSearchInfo();
316
- let scale = map.unitsPerPixel(map.zoom()),
317
- i, j, record, u, v, r;
316
+ const scale = map.unitsPerPixel(map.zoom());
317
+ let i, j, record, u, v, r;
318
318
  for (i = 0; i < m_pointSearchInfo.length; i += 1) {
319
319
  record = m_pointSearchInfo[i];
320
320
  if (!record.max ||
@@ -342,7 +342,7 @@ var lineFeature = function (arg) {
342
342
  (strokeWidthFunc(line[record[j].i], record[j].i, data[i], i) <= 0 && strokeWidthFunc(line[record[j].j], record[j].j, data[i], i) <= 0)) {
343
343
  continue;
344
344
  }
345
- let dist0 = util.distanceToPolygon2d(u, poly),
345
+ const dist0 = util.distanceToPolygon2d(u, poly),
346
346
  dist1 = util.distanceToPolygon2d(v, poly);
347
347
  if ((dist0 > -r * scale && dist0 < r * scale) || (dist1 > -r * scale && dist1 < r & scale) || dist0 * dist1 < 0) {
348
348
  partial = true;
@@ -354,7 +354,7 @@ var lineFeature = function (arg) {
354
354
  }
355
355
  // if a point of the polygon is near the line formed by u-v, this is
356
356
  // also partial
357
- let r2scaled = r * r * scale * scale;
357
+ const r2scaled = r * r * scale * scale;
358
358
  for (let k = 0; k < poly.outer.length && !partial; k += 1) {
359
359
  partial = util.distance2dToLineSquared(poly.outer[k], u, v) < r2scaled;
360
360
  }
package/src/map.js CHANGED
@@ -214,7 +214,7 @@ var map = function (arg) {
214
214
  * existing requestAnimationFrame. By using a property of window,
215
215
  * tests can override this if needed. */
216
216
  if (queue.length && queue[0] !== m_animationQueue[0]) {
217
- window['cancelAnimationFrame'](m_animationQueue[0]);
217
+ window['cancelAnimationFrame'](m_animationQueue[0]); // eslint-disable-line dot-notation
218
218
  }
219
219
  for (var i = queue.length ? 1 : 0; i < m_animationQueue.length; i += 1) {
220
220
  queue.push(m_animationQueue[i]);
@@ -1897,7 +1897,7 @@ var map = function (arg) {
1897
1897
  * explicitly using window.requestAnimationFrame, we prevent the
1898
1898
  * stripping of 'window' off of the reference and allow our tests to
1899
1899
  * override this if needed. */
1900
- m_animationQueue.push(window['requestAnimationFrame'](processAnimationFrame));
1900
+ m_animationQueue.push(window['requestAnimationFrame'](processAnimationFrame)); // eslint-disable-line dot-notation
1901
1901
  }
1902
1902
  var pos = m_animationQueue.indexOf(callback, 1);
1903
1903
  if (pos >= 0) {
@@ -718,6 +718,9 @@ var mapInteractor = function (args) {
718
718
  var Hammer;
719
719
  try {
720
720
  Hammer = require('hammerjs');
721
+ if (!Hammer || !Hammer.Manager) {
722
+ Hammer = undefined;
723
+ }
721
724
  } catch (_error) {}
722
725
  if (Hammer !== undefined) {
723
726
  var recog = [],
@@ -111,11 +111,11 @@ var markerFeature = function (arg) {
111
111
  pts = m_this.data().map(function (d, i) {
112
112
  var pt = position(d, i);
113
113
 
114
- let r = radius(d, i),
115
- swz = scaleWithZoom(d, i),
114
+ let swz = scaleWithZoom(d, i);
115
+ const r = radius(d, i),
116
116
  s = strokeWidth(d, i),
117
117
  so = Math.sign(strokeOffset(d, i));
118
- let rwiths = r + s * (so + 1) / 2, // radius with stroke
118
+ const rwiths = r + s * (so + 1) / 2, // radius with stroke
119
119
  rwos = r + s * (so - 1) / 2; // radius without stroke
120
120
  swz = markerFeature.scaleMode[swz] || (swz >= 1 && swz <= 3 ? swz : 0);
121
121
  switch (swz) {
@@ -155,7 +155,7 @@ var markerFeature = function (arg) {
155
155
  */
156
156
  this._approximateMaxRadius = function (zoom) {
157
157
  m_this._updateRangeTree();
158
- let zoomFactor = Math.pow(2, zoom);
158
+ const zoomFactor = Math.pow(2, zoom);
159
159
  return Math.max(m_maxFixedRadius + m_maxZoomStroke * zoomFactor, m_maxZoomRadius * zoomFactor);
160
160
  };
161
161
 
@@ -344,10 +344,10 @@ var markerFeature = function (arg) {
344
344
  var d = data[i];
345
345
  let p = m_this.position()(d, i);
346
346
  let rad = radius(data[i], i),
347
- swz = scaleWithZoom(data[i], i),
348
- so = strokeOffset(data[i], i),
347
+ swz = scaleWithZoom(data[i], i);
348
+ const so = strokeOffset(data[i], i),
349
349
  s = swz ? strokeWidth(data[i], i) : 0;
350
- let rwos = rad + s * (so - 1) / 2; // radius without stroke
350
+ const rwos = rad + s * (so - 1) / 2; // radius without stroke
351
351
  swz = markerFeature.scaleMode[swz] || (swz >= 1 && swz <= 3 ? swz : 0);
352
352
  rad = rwos + s;
353
353
  switch (swz) {
@@ -363,7 +363,7 @@ var markerFeature = function (arg) {
363
363
  }
364
364
  if (rad) {
365
365
  p = map.gcsToDisplay(p, fgcs);
366
- let dist = util.distanceToPolygon2d(p, poly);
366
+ const dist = util.distanceToPolygon2d(p, poly);
367
367
  if (dist >= rad || (dist >= 0 && opts.partial === 'center') || (dist >= -rad && opts.partial && opts.partial !== 'center')) {
368
368
  found.push(d);
369
369
  ifound.push(i);
package/src/object.js CHANGED
@@ -166,9 +166,7 @@ var object = function () {
166
166
  * the handler that was passed to the function.
167
167
  */
168
168
  this.geoOnce = function (event, handler) {
169
- let wrapper;
170
-
171
- wrapper = function (args) {
169
+ const wrapper = function (args) {
172
170
  m_this.geoOff(event, wrapper);
173
171
  handler.call(m_this, args);
174
172
  };
package/src/osmLayer.js CHANGED
@@ -93,7 +93,7 @@ var osmLayer = function (arg) {
93
93
  */
94
94
  this.source = function (source) {
95
95
  if (source === undefined) {
96
- for (let key in osmLayer.tileSources) {
96
+ for (const key in osmLayer.tileSources) {
97
97
  if (osmLayer.tileSources[key].url === m_this.url()) {
98
98
  return key;
99
99
  }
@@ -126,13 +126,13 @@ osmLayer.defaults = $.extend({}, tileLayer.defaults, {
126
126
  /* Stamen's website (http://maps.stamen.com) as of 2019-08-28 says that the
127
127
  * maps they host may be used free of charge. For http access, use a url like
128
128
  * http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png */
129
- let StamenAttribution = 'Map tiles by <a href="http://stamen.com">Stamen ' +
129
+ const StamenAttribution = 'Map tiles by <a href="http://stamen.com">Stamen ' +
130
130
  'Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">' +
131
131
  'CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap' +
132
132
  '</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.';
133
133
 
134
134
  /* Per Carto's website regarding basemap attribution: https://carto.com/help/working-with-data/attribution/#basemaps */
135
- let CartoAttribution = '<a href="https://carto.com"> Carto</a> ' + 'Contributors <a href="https://www.openstreetmap.org/"> OpenStreetMap</a>';
135
+ const CartoAttribution = '<a href="https://carto.com"> Carto</a> ' + 'Contributors <a href="https://www.openstreetmap.org/"> OpenStreetMap</a>';
136
136
 
137
137
  /**
138
138
  * This is a list of known tile sources. It can be added to via
@@ -47,7 +47,7 @@ var util = require('./util');
47
47
  * @property {object[]} mappedColors This has one entry for each distinct index
48
48
  * value. Each entry has `first` and `last` with the first and last pixel
49
49
  * locations where that index occurs. Note that last is the inclusive value
50
- * of the location (so its maximum possible value is `size -1`).
50
+ * of the location (so its maximum possible value is `size - 1`).
51
51
  */
52
52
 
53
53
  /**
@@ -443,7 +443,7 @@ var pointFeature = function (arg) {
443
443
  rad += hasstroke ? strokeWidth(data[i], i) : 0;
444
444
  if (rad) {
445
445
  p = map.gcsToDisplay(p, fgcs);
446
- let dist = util.distanceToPolygon2d(p, poly);
446
+ const dist = util.distanceToPolygon2d(p, poly);
447
447
  if (dist >= rad || (dist >= 0 && opts.partial === 'center') || (dist >= -rad && opts.partial && opts.partial !== 'center')) {
448
448
  found.push(d);
449
449
  ifound.push(i);
@@ -113,7 +113,7 @@ var polygonFeature = function (arg) {
113
113
  * `outer` and `inner` if it has any coordinates, or is `undefined`.
114
114
  */
115
115
  function getCoordinates(data, posFunc, polyFunc) {
116
- let fcs = m_this.gcs(),
116
+ const fcs = m_this.gcs(),
117
117
  mapgcs = m_this.layer().map().gcs();
118
118
  data = data || m_this.data();
119
119
  posFunc = posFunc || m_this.style.get('position');
@@ -121,7 +121,7 @@ var polygonFeature = function (arg) {
121
121
  var coordinates = data.map(function (d, i) {
122
122
  var poly = polyFunc(d, i);
123
123
  if (!poly) {
124
- return;
124
+ return undefined;
125
125
  }
126
126
  var outer, inner, range, coord, j, x, y, mapouter, mapinner, maprange;
127
127
 
@@ -350,9 +350,9 @@ var polygonFeature = function (arg) {
350
350
  let inside, partial;
351
351
  // do something similar to the line's polygonSearch
352
352
  for (let r = -1; r < coord.mapinner.length && !partial; r += 1) {
353
- let record = r < 0 ? coord.mapouter : coord.mapinner[r];
353
+ const record = r < 0 ? coord.mapouter : coord.mapinner[r];
354
354
  for (let i = 0, len = record.length, j = len - 1; i < len; j = i, i += 1) {
355
- let dist0 = util.distanceToPolygon2d(record[i], poly),
355
+ const dist0 = util.distanceToPolygon2d(record[i], poly),
356
356
  dist1 = util.distanceToPolygon2d(record[j], poly);
357
357
  if (dist0 * dist1 < 0) {
358
358
  partial = true;
package/src/registry.js CHANGED
@@ -216,7 +216,7 @@ util.registerFeature = function (category, name, func, capabilities) {
216
216
  */
217
217
  util.createFeature = function (name, layer, renderer, arg) {
218
218
  var category = renderer.api(),
219
- options = {'layer': layer, 'renderer': renderer};
219
+ options = {layer: layer, renderer: renderer};
220
220
  if (category in features && name in features[category]) {
221
221
  if (arg !== undefined) {
222
222
  $.extend(true, options, arg);
@@ -681,6 +681,9 @@ svgRenderer.supported = function () {
681
681
  // webpack expects optional dependencies to be wrapped in a try-catch
682
682
  try {
683
683
  svgRenderer.d3 = require('d3');
684
+ if (!svgRenderer.d3 || !svgRenderer.d3.rgb) {
685
+ svgRenderer.d3 = undefined;
686
+ }
684
687
  } catch (_error) {}
685
688
  return svgRenderer.d3 !== undefined;
686
689
  };
@@ -157,7 +157,7 @@ var svg_vectorFeature = function (arg) {
157
157
  .each(function (d) {
158
158
  var marker = d3.select(this);
159
159
  var markerData = d.head ? markerConfigs[endStyle(d.data, d.dataIndex)] : markerConfigs[originStyle(d.data, d.dataIndex)];
160
- Object.keys(markerData.attrs).map(function (attrName) {
160
+ Object.keys(markerData.attrs).forEach(function (attrName) {
161
161
  marker.attr(attrName, markerData.attrs[attrName]);
162
162
  });
163
163
  })
package/src/tileLayer.js CHANGED
@@ -121,10 +121,10 @@ function m_getTileSubdomain(x, y, z, subdomains) {
121
121
  * @private.
122
122
  */
123
123
  function m_tileUrlFromTemplate(base) {
124
- var xPattern = new RegExp(/\$?\{[xX]\}/g),
125
- yPattern = new RegExp(/\$?\{[yY]\}/g),
126
- zPattern = new RegExp(/\$?\{[zZ]\}/g),
127
- sPattern = new RegExp(/\$?\{(s|S|[sS]:[^{}]+|[^-{}]-[^-{}]|([^,{}]+,)+[^,{}]+)\}/);
124
+ var xPattern = /\$?\{[xX]\}/g,
125
+ yPattern = /\$?\{[yY]\}/g,
126
+ zPattern = /\$?\{[zZ]\}/g,
127
+ sPattern = /\$?\{(s|S|[sS]:[^{}]+|[^-{}]-[^-{}]|([^,{}]+,)+[^,{}]+)\}/;
128
128
  var url = base
129
129
  .replace(new RegExp(sPattern, 'g'), '{s}')
130
130
  .replace(xPattern, '{x}')