geojs 1.12.6 → 1.12.8

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.12.6",
3
+ "version": "1.12.8",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -97,6 +97,11 @@
97
97
  "webpack-merge": "^6.0.1",
98
98
  "webpack-string-replacer": "^0.0.20"
99
99
  },
100
+ "overrides": {
101
+ "npm-run-all": {
102
+ "cross-spawn": "^7.0.5"
103
+ }
104
+ },
100
105
  "release": {
101
106
  "plugins": [
102
107
  "@semantic-release/commit-analyzer",
@@ -496,8 +496,7 @@ var annotationLayer = function (arg) {
496
496
  * @fires geo.event.annotation.add
497
497
  */
498
498
  this.addAnnotation = function (annotation, gcs, update) {
499
- var pos = $.inArray(annotation, m_annotations);
500
- if (pos < 0) {
499
+ if (m_annotationIds[annotation.id()] === undefined) {
501
500
  while (m_this.annotationById(annotation.id())) {
502
501
  annotation.newId();
503
502
  }
@@ -530,12 +529,14 @@ var annotationLayer = function (arg) {
530
529
  * @param {geo.annotation} annotation The annotation to remove.
531
530
  * @param {boolean} [update] If `false`, don't update the layer after removing
532
531
  * the annotation.
532
+ * @param {int} [pos] The posiiton of the annotation in the annotation list,
533
+ * if known. This speeds up the process.
533
534
  * @returns {boolean} `true` if an annotation was removed.
534
535
  * @fires geo.event.annotation.remove
535
536
  */
536
- this.removeAnnotation = function (annotation, update) {
537
- var pos = $.inArray(annotation, m_annotations);
538
- if (pos >= 0) {
537
+ this.removeAnnotation = function (annotation, update, pos) {
538
+ if (annotation.id && m_annotationIds[annotation.id()] !== undefined) {
539
+ pos = m_annotations.indexOf(annotation);
539
540
  if (annotation === m_this.currentAnnotation) {
540
541
  m_this.currentAnnotation = null;
541
542
  }
@@ -551,8 +552,9 @@ var annotationLayer = function (arg) {
551
552
  m_this.geoTrigger(geo_event.annotation.remove, {
552
553
  annotation: annotation
553
554
  });
555
+ return true;
554
556
  }
555
- return pos >= 0;
557
+ return false;
556
558
  };
557
559
 
558
560
  /**
@@ -565,14 +567,13 @@ var annotationLayer = function (arg) {
565
567
  * @returns {number} The number of annotations that were removed.
566
568
  */
567
569
  this.removeAllAnnotations = function (skipCreating, update) {
568
- var removed = 0, annotation, pos = 0;
569
- while (pos < m_annotations.length) {
570
+ var removed = 0, annotation;
571
+ for (let pos = m_annotations.length - 1; pos >= 0; pos -= 1) {
570
572
  annotation = m_annotations[pos];
571
573
  if (skipCreating && annotation.state() === geo_annotation.state.create) {
572
- pos += 1;
573
574
  continue;
574
575
  }
575
- m_this.removeAnnotation(annotation, false);
576
+ m_this.removeAnnotation(annotation, false, pos);
576
577
  removed += 1;
577
578
  }
578
579
  if (removed && update !== false) {
@@ -814,7 +815,7 @@ var annotationLayer = function (arg) {
814
815
  var type = (data.properties || {}).annotationType || feature.featureType,
815
816
  options = Object.assign({}, data.properties || {}),
816
817
  position, datagcs, i, existing;
817
- if ($.inArray(type, annotationList) < 0) {
818
+ if (!annotationList.includes(type)) {
818
819
  return;
819
820
  }
820
821
  options.style = options.style || {};
package/src/fetchQueue.js CHANGED
@@ -144,7 +144,7 @@ var fetchQueue = function (options) {
144
144
  */
145
145
  this.add = function (defer, callback, atEnd) {
146
146
  if (defer.__fetchQueue) {
147
- var pos = $.inArray(defer, m_this._queue);
147
+ var pos = m_this._queue.indexOf(defer);
148
148
  if (pos >= 0) {
149
149
  // m_this._queue.splice(pos, 1);
150
150
  m_this._addToQueue(defer, atEnd, pos);
@@ -215,7 +215,7 @@ var fetchQueue = function (options) {
215
215
  * @returns {number} -1 if not in the queue, or the position in the queue.
216
216
  */
217
217
  this.get = function (defer) {
218
- return $.inArray(defer, m_this._queue);
218
+ return m_this._queue.indexOf(defer);
219
219
  };
220
220
 
221
221
  /**
@@ -225,7 +225,7 @@ var fetchQueue = function (options) {
225
225
  * @returns {boolean} `true` if the object was removed.
226
226
  */
227
227
  this.remove = function (defer) {
228
- var pos = $.inArray(defer, m_this._queue);
228
+ var pos = m_this._queue.indexOf(defer);
229
229
  if (pos >= 0) {
230
230
  m_this._queue.splice(pos, 1);
231
231
  return true;
@@ -1598,8 +1598,7 @@ var mapInteractor = function (args) {
1598
1598
  clearState();
1599
1599
 
1600
1600
  // if momentum is enabled, start the action here
1601
- if (m_options.momentum.enabled &&
1602
- $.inArray(oldAction, m_options.momentum.actions) >= 0) {
1601
+ if (m_options.momentum.enabled && m_options.momentum.actions.includes(oldAction)) {
1603
1602
  var t = (new Date()).valueOf();
1604
1603
  var dt = t - m_mouse.time + m_mouse.deltaTime;
1605
1604
  if (t - m_mouse.time < m_options.momentum.stopTime) {
@@ -33,7 +33,7 @@ var pointFeature = require('./pointFeature');
33
33
  * @property {number|function} [strokeOffset=-1] The position of the stroke
34
34
  * compared to the radius. This can only be -1, 0, or 1 (the sign of the
35
35
  * value is used).
36
- * @property {boolean|function} [radiusIncludeStroke=true] If truthy or
36
+ * @property {boolean|function} [radiusIncludesStroke=true] If truthy or
37
37
  * undefined, the `radius` includes the `strokeWidth` based on the
38
38
  * `strokeOffset`. If defined and falsy, the radius does not include the
39
39
  * `strokeWidth`.
@@ -466,8 +466,8 @@ var quadFeature = function (arg) {
466
466
  prev_onload = image.onload;
467
467
  image.onload = function () {
468
468
  if (previewColor !== undefined) {
469
- if ($.inArray(quad, clrQuads) >= 0) {
470
- clrQuads.splice($.inArray(quad, clrQuads), 1);
469
+ if (clrQuads.includes(quad)) {
470
+ clrQuads.splice(clrQuads.indexOf(quad), 1);
471
471
  }
472
472
  delete quadinfo.clrquad;
473
473
  }
@@ -544,8 +544,8 @@ var quadFeature = function (arg) {
544
544
  prev_onload = video.onloadeddata;
545
545
  video.onloadeddata = function () {
546
546
  if (previewColor !== undefined) {
547
- if ($.inArray(quad, clrQuads) >= 0) {
548
- clrQuads.splice($.inArray(quad, clrQuads), 1);
547
+ if (clrQuads.includes(quad)) {
548
+ clrQuads.splice(clrQuads.indexOf(quad), 1);
549
549
  }
550
550
  delete quadinfo.clrquad;
551
551
  }
package/src/registry.js CHANGED
@@ -1,4 +1,3 @@
1
- var $ = require('jquery');
2
1
  var geo_action = require('./action');
3
2
  var util = require('./util/common');
4
3
 
@@ -460,7 +459,7 @@ registry.featuresForAnnotations = function (annotationList) {
460
459
  features.push(feature);
461
460
  } else {
462
461
  annotationList[ann].forEach(function (state) {
463
- if ($.inArray(state, annotations[ann].features[feature]) >= 0) {
462
+ if (annotations[ann].features[feature].includes(state)) {
464
463
  features.push(feature);
465
464
  }
466
465
  });
@@ -464,7 +464,7 @@ var util = {
464
464
  do {
465
465
  found = util.hasAction(actions, action, name, owner);
466
466
  if (found) {
467
- actions.splice($.inArray(found, actions), 1);
467
+ actions.splice(actions.indexOf(found), 1);
468
468
  removed += 1;
469
469
  }
470
470
  } while (found);
@@ -1010,7 +1010,7 @@ var util = {
1010
1010
  continue;
1011
1011
  }
1012
1012
  const copy = source[key];
1013
- if (copy && typeof copy === 'object' && copy && (copy.constructor === undefined || copy.constructor === Object || Array.isArray(copy))) {
1013
+ if (copy && typeof copy === 'object' && (copy.constructor === Object || Array.isArray(copy))) {
1014
1014
  let src = target[key];
1015
1015
  if (!Array.isArray(copy)) {
1016
1016
  if (typeof src !== 'object' || Array.isArray(src)) {