geojs 1.7.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geojs",
3
- "version": "1.7.0",
3
+ "version": "1.7.3",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "vtk.js": "*"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "^7.16.5",
33
+ "@babel/core": "^7.17.0",
34
34
  "@babel/plugin-proposal-class-properties": "^7.16.5",
35
35
  "@babel/preset-env": "^7.16.5",
36
36
  "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
@@ -40,7 +40,7 @@
40
40
  "bootswatch": "^3.4.1",
41
41
  "codemirror": "^5.65.0",
42
42
  "colorbrewer": "^1.5.1",
43
- "css-loader": "^6.5.1",
43
+ "css-loader": "^6.6.0",
44
44
  "docco": "^0.9.1",
45
45
  "eslint": "^7.12.1",
46
46
  "eslint-config-semistandard": "^16.0.0",
@@ -57,13 +57,13 @@
57
57
  "jaguarjs-jsdoc": "^1.0.2",
58
58
  "jasmine-core": "^4.0.0",
59
59
  "js-yaml": "^4.1.0",
60
- "jsdoc": "^3.6.7",
60
+ "jsdoc": "^3.6.10",
61
61
  "jsdoc-autoprivate": "0.0.1",
62
62
  "jsonlint-mod": "^1.7.6",
63
63
  "jstransformer-markdown-it": "^2.0.0",
64
- "karma": "^6.3.13",
64
+ "karma": "^6.3.15",
65
65
  "karma-chrome-launcher": "^3.1.0",
66
- "karma-coverage": "^2.1.0",
66
+ "karma-coverage": "^2.1.1",
67
67
  "karma-firefox-launcher": "^2.1.2",
68
68
  "karma-jasmine": "^4.0.1",
69
69
  "karma-jasmine-html-reporter": "^1.7.0",
@@ -72,6 +72,7 @@
72
72
  "karma-spec-reporter": "^0.0.33",
73
73
  "karma-webpack": "^5.0.0",
74
74
  "nib": "^1.1.2",
75
+ "npm-run-all": "^4.1.5",
75
76
  "pako": "^2.0.4",
76
77
  "pug": "^3.0.2",
77
78
  "pug-lint": "^2.6.0",
@@ -124,7 +125,9 @@
124
125
  ]
125
126
  },
126
127
  "scripts": {
127
- "build": "webpack --config webpack.config.js && webpack --config webpack-lean.config.js",
128
+ "build": "npm-run-all -p build-full build-lean",
129
+ "build-full": "webpack --config webpack.config.js",
130
+ "build-lean": "webpack --config webpack-lean.config.js",
128
131
  "build-examples": "node examples/build.js && webpack --config webpack-examples.config.js",
129
132
  "build-website-examples": "node examples/build-website.js && webpack --config webpack-website-examples.config.js",
130
133
  "build-tutorials": "node tutorials/build.js && webpack --config webpack-tutorials.config.js",
@@ -143,19 +146,18 @@
143
146
  "test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
144
147
  "get-data-files": "node scripts/datastore.js dist/data",
145
148
  "ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
146
- "ci": "npm run ci-build && npm run ci-test",
147
- "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)'",
148
- "ci-build-wait": "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 && FAIL=0 || FAIL=1; wait; [ \"$FAIL\" == \"0\" ])'",
149
- "ci-test": "npm run test-headless && npm run test-webglheadless && npm run test-headed && npm run test-tutorials",
150
- "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",
149
+ "ci": "npm-run-all ci-build ci-test",
150
+ "ci-build": "npm-run-all -c -p build-full build-lean docs get-data-files lint puglint glsllint build-examples build-tutorials",
151
+ "ci-test": "npm-run-all test-headless test-webglheadless test-headed test-tutorials",
152
+ "ci-xvfb": "npm-run-all ci-clean ci-build && TEST_SAVE_IMAGE='all' xvfb-run -s '-ac -screen 0 1280x1024x24' npm run ci-test",
151
153
  "start": "karma start karma.conf.js",
152
- "examples": "node examples/build.js && webpack --config webpack-examples.config.js && node tutorials/build.js && webpack --config webpack-tutorials.config.js && node ./tests/runners/server.js --host \"${HOST-}\" --port ${PORT-8082} --dist",
154
+ "examples": "npm-run-all -p build-examples build-tutorials && node ./tests/runners/server.js --host \"${HOST-}\" --port ${PORT-8082} --dist",
153
155
  "docs": "jsdoc --pedantic -d dist/apidocs -r src package.json -c jsdoc.conf.json",
154
156
  "website": "cd website && npx hexo server",
155
157
  "setup-website": "cd website && npm install",
156
- "build-website": "npm run ci-build && npm run ci-build-website",
158
+ "build-website": "npm-run-all ci-build ci-build-website",
157
159
  "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 && cp -ar data ../website/source/. && rm -rf ../website/source/data/tiles && rm -rf ../website/source/data/tiles.tgz && rm -rf ../website/source/data/base-images && rm -rf ../website/source/data/base-images.tgz && cp -ar apidocs/. ../website/source/apidocs && cd ../website && npm install && rm -f db.json && npx hexo generate",
158
- "prepublishOnly": "webpack --config webpack.config.js && webpack --config webpack-lean.config.js && cp dist/built/*.js .",
160
+ "prepublishOnly": "npm run build && cp dist/built/*.js .",
159
161
  "semantic-release": "semantic-release"
160
162
  },
161
163
  "keywords": [
package/src/event.js CHANGED
@@ -50,6 +50,16 @@ geo_event.layerAdd = 'geo_layerAdd';
50
50
  */
51
51
  geo_event.layerRemove = 'geo_layerRemove';
52
52
 
53
+ /**
54
+ * Triggered when a layer z-index is changed.
55
+ *
56
+ * @event geo.event.layerMove
57
+ * @type {geo.event.base}
58
+ * @property {geo.map} target The current map.
59
+ * @property {geo.layer} layer The old layer that was removed.
60
+ */
61
+ geo_event.layerMove = 'geo_layerMove';
62
+
53
63
  /**
54
64
  * Triggered when the map's zoom level is changed.
55
65
  *
package/src/layer.js CHANGED
@@ -174,7 +174,7 @@ var layer = function (arg) {
174
174
  if (zIndex !== m_zIndex) {
175
175
  m_zIndex = zIndex;
176
176
  m_node.css('z-index', m_zIndex);
177
- m_this.geoTrigger(geo_event.layerRemove, {
177
+ m_this.geoTrigger(geo_event.layerMove, {
178
178
  layer: m_this
179
179
  });
180
180
  }
package/src/tileLayer.js CHANGED
@@ -676,7 +676,10 @@ var tileLayer = function (arg) {
676
676
  this._getTiles = function (maxLevel, bounds, sorted, onlyIfChanged) {
677
677
  var i, j, tiles = [], index, nTilesLevel,
678
678
  start, end, indexRange, source, center, changed = false, old, level,
679
- minLevel = (m_this._options.keepLower ? m_this._options.minLevel : Math.max(maxLevel, m_this._options.minLevel));
679
+ minLevel = (
680
+ m_this._options.keepLower ?
681
+ m_this._options.minLevel :
682
+ Math.min(Math.max(maxLevel, m_this._options.minLevel), m_this._options.maxLevel));
680
683
  if (maxLevel < minLevel) {
681
684
  maxLevel = minLevel;
682
685
  }
@@ -1533,7 +1536,9 @@ var tileLayer = function (arg) {
1533
1536
  * semi-transparent layers. */
1534
1537
  if ((doneLoading || m_this._isCovered(tile)) &&
1535
1538
  zoom !== tile.index.level &&
1536
- (zoom >= m_this._options.minLevel || tile.index.level !== m_this._options.minLevel)) {
1539
+ (zoom >= m_this._options.minLevel || tile.index.level !== m_this._options.minLevel) &&
1540
+ (zoom < m_this._options.maxLevel || tile.index.level !== m_this._options.maxLevel)
1541
+ ) {
1537
1542
  return true;
1538
1543
  }
1539
1544
  }
@@ -1667,9 +1672,9 @@ var tileLayer = function (arg) {
1667
1672
  /**
1668
1673
  * Get/set the baseQuad.
1669
1674
  *
1670
- * @property {object} [baseQuad] A quad feature element to draw before below
1671
- * any tile layers. If specified, this uses the quad defaults, so this is
1672
- * a ``geo.quadFeature.position`` object with, typically, an ``image``
1675
+ * @property {object} [baseQuad] A quad feature element to draw below any
1676
+ * tile layers. If specified, this uses the quad defaults, so this is a
1677
+ * ``geo.quadFeature.position`` object with, typically, an ``image``
1673
1678
  * property added to it. The quad positions are in the map gcs
1674
1679
  * coordinates.
1675
1680
  * @name geo.tileLayer.baseQuad
@@ -3,6 +3,8 @@ var registerFeature = require('../registry').registerFeature;
3
3
  var quadFeature = require('../quadFeature');
4
4
  var timestamp = require('../timestamp');
5
5
 
6
+ let _memoryCheckLargestTested = 4096 * 4096;
7
+
6
8
  /**
7
9
  * Create a new instance of class quadFeature.
8
10
  *
@@ -373,8 +375,11 @@ var webgl_quadFeature = function (arg) {
373
375
  quad.texture.bind(renderState);
374
376
  // only check if the context is out of memory when using modestly large
375
377
  // textures. The check is slow.
376
- if ((quad.image.width > 4096 || quad.image.height > 4096 || quad.image.width * quad.image.height > 4194304) && context.getError() === context.OUT_OF_MEMORY) {
377
- console.log('Insufficient GPU memory for texture');
378
+ if (quad.image.width * quad.image.height > _memoryCheckLargestTested) {
379
+ _memoryCheckLargestTested = quad.image.width * quad.image.height;
380
+ if (context.getError() === context.OUT_OF_MEMORY) {
381
+ console.log('Insufficient GPU memory for texture');
382
+ }
378
383
  }
379
384
  if (quad.opacity !== opacity) {
380
385
  opacity = quad.opacity;
@@ -184,11 +184,12 @@ var webglRenderer = function (arg) {
184
184
  renderState.m_renderer = m_viewer;
185
185
  renderState.m_context = m_this._glContext();
186
186
  m_viewer.exit(renderState);
187
- if (m_this._glContext() !== vgl.GL && m_this._glContext().getExtension('WEBGL_lose_context') && m_this._glContext().getExtension('WEBGL_lose_context').loseContext) {
188
- m_this._glContext().getExtension('WEBGL_lose_context').loseContext();
187
+ const context = m_this._glContext();
188
+ if (context !== vgl.GL && context.getExtension('WEBGL_lose_context') && context.getExtension('WEBGL_lose_context').loseContext) {
189
+ context.getExtension('WEBGL_lose_context').loseContext();
189
190
  }
190
191
  }
191
- // make sure we clear shaders associated with the generate context, too
192
+ // make sure we clear shaders associated with the generated context, too
192
193
  vgl.clearCachedShaders(vgl.GL);
193
194
  m_viewer = null;
194
195
  s_exit();