@pirireis/webglobeplugins 0.15.5-alpha → 0.15.7-alpha

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/Math/vec3.js CHANGED
@@ -60,7 +60,11 @@ function length(a) {
60
60
  function normalize(outVec, inVec) {
61
61
  const len = length(inVec);
62
62
  if (len === 0) {
63
- throw new Error('Cannot normalize a zero vector');
63
+ console.warn('Cannot normalize a zero vector');
64
+ outVec[0] = 0;
65
+ outVec[1] = 0;
66
+ outVec[2] = 0;
67
+ return;
64
68
  }
65
69
  outVec[0] = inVec[0] / len;
66
70
  outVec[1] = inVec[1] / len;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.15.5-alpha",
3
+ "version": "0.15.7-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@ const _0vec3 = /* @__PURE__ */ [0, 0, 0];
14
14
  * @typedef {Array<Point>, rgba, trackID} Track
15
15
  */
16
16
  class PointTracksPlugin {
17
- constructor(id, { pointSize = 2, hoveredPointSize = 4, selectionPointFilling = 4, opacity = 1.0 } = {}) {
17
+ constructor(id, { pointSize = 2, hoveredPointSize = 4, selectionPointFilling = 4, opacity = 1.0, objectStoreExtraParameters = ["long", "lat", "height"] } = {}) {
18
18
  this.id = id;
19
19
  this._isFreed = false;
20
20
  this._pointProgram = null;
@@ -30,10 +30,11 @@ class PointTracksPlugin {
30
30
  this._lastWH = { w: 0, h: 0 };
31
31
  this._focusParams = { on: false, length: 0, elementBuffer: null, trackIDs: [] };
32
32
  this.pointSizes = {
33
- pointSize,
34
- selectionPointFilling,
35
- hoveredPointSize
33
+ pointSize: pointSize ? pointSize : 2,
34
+ selectionPointFilling: selectionPointFilling ? selectionPointFilling : 4,
35
+ hoveredPointSize: hoveredPointSize ? hoveredPointSize : 4
36
36
  };
37
+ this._objectStoreExtraParameters = objectStoreExtraParameters;
37
38
  }
38
39
  init(globe, gl) {
39
40
  this.globe = globe;
@@ -67,9 +68,17 @@ class PointTracksPlugin {
67
68
  ["objectStore", {
68
69
  bufferManager: new ObjectStore({ initialCapacity }),
69
70
  adaptor: (item) => {
70
- return {
71
- trackID: item.trackID, pointID: item.pointID
71
+ const result = {
72
+ trackID: item.trackID,
73
+ pointID: item.pointID,
72
74
  };
75
+ // Add extra parameters specified in _objectStoreExtraParameters
76
+ this._objectStoreExtraParameters.forEach(param => {
77
+ if (item.hasOwnProperty(param)) {
78
+ result[param] = item[param];
79
+ }
80
+ });
81
+ return result;
73
82
  }
74
83
  }]
75
84
  ]);