geojs 1.9.2 → 1.9.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.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -67,7 +67,7 @@
67
67
  "karma-coverage": "^2.1.1",
68
68
  "karma-firefox-launcher": "^2.1.2",
69
69
  "karma-jasmine": "^5.0.0",
70
- "karma-jasmine-html-reporter": "^1.7.0",
70
+ "karma-jasmine-html-reporter": "^2.0.0",
71
71
  "karma-sinon": "^1.0.5",
72
72
  "karma-sourcemap-loader": "^0.3.8",
73
73
  "karma-spec-reporter": "^0.0.34",
@@ -85,7 +85,7 @@
85
85
  "shader-loader": "^1.3.1",
86
86
  "sinon": "^14.0.0",
87
87
  "style-loader": "^3.3.1",
88
- "stylus": "^0.57.0",
88
+ "stylus": "^0.58.1",
89
89
  "stylus-loader": "^7.0.0",
90
90
  "terser-webpack-plugin": "^5.3.1",
91
91
  "touch-emulator": "^1.0.0",
@@ -49,6 +49,17 @@ var textFeature = require('./textFeature');
49
49
  * style object.
50
50
  */
51
51
 
52
+ /**
53
+ * @typedef {geo.util.polyop.spec} geo.util.polyop.annotationLayerSpec
54
+ * @extends {geo.util.polyop.spec}
55
+ * @property {string} [keepAnnotations='exact'] Determine which annotations are
56
+ * present after a boolean operation. `'exact'` replaces modified
57
+ * annotations with the results; unmodified annotations are left as is.
58
+ * `'all'` replaces all annotations, so unchanged annotations may be
59
+ * converted to polygonAnnotations. `'none'` discards all existing
60
+ * annotations and only keeps modified results.
61
+ */
62
+
52
63
  /**
53
64
  * Layer to handle direct interactions with different features. Annotations
54
65
  * (features) can be created by calling mode(<name of feature>) or cancelled
@@ -1261,8 +1272,8 @@ var annotationLayer = function (arg) {
1261
1272
  * Replace appropriate annotations with a list of polygons.
1262
1273
  *
1263
1274
  * @param {geo.polygonList} poly A list of polygons.
1264
- * @param {geo.util.polyop.spec} [opts] This contains annotationIndices and
1265
- * correspondence used to track annotations.
1275
+ * @param {geo.util.polyop.annotationLayerSpec} [opts] This contains
1276
+ * annotationIndices and correspondence used to track annotations.
1266
1277
  * @returns {this}
1267
1278
  */
1268
1279
  this.fromPolygonList = function (poly, opts) {
@@ -46,9 +46,12 @@ var util = require('./util');
46
46
  * divided by the sine of half the angle between segments, then a bevel join
47
47
  * is used instead. This is a single value that applies to all lines. If a
48
48
  * function, it is called with `(data)`.
49
- * @property {boolean|function} [uniformLine=false] Boolean indicating if each
50
- * line has a uniform style (uniform stroke color, opacity, and width). Can
51
- * vary by line.
49
+ * @property {boolean|string|function} [uniformLine=false] Boolean indicating
50
+ * if each line has a uniform style (uniform stroke color, opacity, and
51
+ * width). Can vary by line. A value of `'drop'` will modify rendered
52
+ * vertex order by dropping duplicates and setting later values to zero
53
+ * opacity. This can be faster but makes it so updating the style array
54
+ * can no longer be used.
52
55
  * @property {number|function} [antialiasing] Antialiasing distance in pixels.
53
56
  * Values must be non-negative. A value greater than 1 will produce a
54
57
  * visible gradient. This is a single value that applies to all lines.
@@ -816,7 +816,9 @@ var trackFeature = function (arg) {
816
816
  {
817
817
  track: util.identityFunction,
818
818
  position: util.identityFunction,
819
- time: (d, i) => (d.t !== undefined ? d.t : i)
819
+ time: (d, i) => (d.t !== undefined ? d.t : i),
820
+ uniformLine: 'drop',
821
+ closed: false
820
822
  },
821
823
  arg.style === undefined ? {} : arg.style
822
824
  );
@@ -269,6 +269,7 @@ var webgl_lineFeature = function (arg) {
269
269
  closedVal = closed[i];
270
270
  firstPosIdx3 = posIdx3;
271
271
  maxj = lineItem.length + (closedVal === 2 ? 1 : 0);
272
+ let skipped = 0;
272
273
  for (j = 0; j < maxj; j += 1, posIdx3 += 3) {
273
274
  lidx = j;
274
275
  if (j === lineItem.length) {
@@ -329,9 +330,17 @@ var webgl_lineFeature = function (arg) {
329
330
  }
330
331
 
331
332
  if (j) {
333
+ if (uniform === 'drop' && j > 1 && position[vert[0].pos] === position[vert[1].pos] && position[vert[0].pos + 1] === position[vert[1].pos + 1]) {
334
+ skipped += 1;
335
+ continue;
336
+ }
332
337
  /* zero out the z position. This can be changed if we handle it in
333
338
  * the shader. */
334
339
  for (k = 0; k < orderLen; k += 1, dest += 1, dest3 += 3) {
340
+ if (uniform === 'drop' && vert[0].strokeOpacity <= 0 && vert[1].strokeOpacity <= 0) {
341
+ strokeOpacityBuf[dest] = -1;
342
+ continue;
343
+ }
335
344
  orderk0 = order[k][0];
336
345
  v1 = vert[orderk0];
337
346
  v2 = vert[1 - orderk0];
@@ -370,6 +379,11 @@ var webgl_lineFeature = function (arg) {
370
379
  }
371
380
  }
372
381
  }
382
+ if (skipped) {
383
+ for (k = 0; k < skipped * orderLen; k += 1, dest += 1, dest3 += 3) {
384
+ strokeOpacityBuf[dest] = -1;
385
+ }
386
+ }
373
387
  }
374
388
 
375
389
  if (!onlyStyle) {