@pirireis/webglobeplugins 1.4.0 → 1.4.2

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": "@pirireis/webglobeplugins",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -55,9 +55,7 @@ ${relativeBBoxPositionRadian}
55
55
 
56
56
 
57
57
  void main() {
58
- float elevation = ${WORLD_RADIUS_3D};
59
- float altitude = 20000.0;
60
- bool hasDemSample = false;
58
+
61
59
 
62
60
  // Always define v_index to avoid undefined varyings when picking is disabled.
63
61
 
@@ -74,6 +72,9 @@ void main() {
74
72
  // Always define v_index to avoid undefined varyings when picking is disabled.
75
73
  v_index = a_index;
76
74
 
75
+
76
+ float elevation = ${WORLD_RADIUS_3D};
77
+ float altitude = 20000.0;
77
78
  if (is3D == true) {
78
79
  for (int i = 0; i < 6; i++) {
79
80
  if( i == u_breakLoopIndex - 1 ) {
@@ -89,35 +89,41 @@ const glProgramCache = (function () {
89
89
  })();
90
90
  const noRegisterGlobeProgramCache = (function () {
91
91
  const cache = new Map();
92
- const keyFunction = (globe, ProgramClass, mode) => `${globe.id}_${ProgramClass.name}_${mode}`;
93
92
  function getProgram(globe, ProgramClass, mode) {
94
- const key = keyFunction(globe, ProgramClass, mode);
95
93
  if (!cache.has(globe)) {
96
94
  cache.set(globe, new Map());
97
95
  }
98
96
  ;
99
- if (!cache.get(globe).has(key)) {
100
- cache.get(globe).set(key, {
97
+ if (!cache.get(globe).has(ProgramClass)) {
98
+ cache.get(globe).set(ProgramClass, new Map());
99
+ }
100
+ ;
101
+ const modeKey = mode !== undefined ? mode : '__default__';
102
+ if (!cache.get(globe).get(ProgramClass).has(modeKey)) {
103
+ cache.get(globe).get(ProgramClass).set(modeKey, {
101
104
  program: new ProgramClass(globe, mode),
102
105
  count: 1
103
106
  });
104
107
  }
105
108
  else {
106
- cache.get(globe).get(key).count++;
109
+ cache.get(globe).get(ProgramClass).get(modeKey).count++;
107
110
  }
108
- return cache.get(globe).get(key).program;
111
+ return cache.get(globe).get(ProgramClass).get(modeKey).program;
109
112
  }
110
113
  ;
111
114
  function releaseProgram(globe, ProgramClass, mode) {
112
- const key = keyFunction(globe, ProgramClass, mode);
113
- if (cache.has(globe) && cache.get(globe).has(key)) {
114
- if (cache.get(globe).get(key).count === 0) {
115
+ const modeKey = mode !== undefined ? mode : '__default__';
116
+ if (cache.has(globe) && cache.get(globe).has(ProgramClass) && cache.get(globe).get(ProgramClass).has(modeKey)) {
117
+ if (cache.get(globe).get(ProgramClass).get(modeKey).count === 0) {
115
118
  throw new Error("The program counter is already 0, cannot release program");
116
119
  }
117
- cache.get(globe).get(key).count--;
118
- if (cache.get(globe).get(key).count === 0) {
119
- cache.get(globe).get(key).program.free();
120
- cache.get(globe).delete(key);
120
+ cache.get(globe).get(ProgramClass).get(modeKey).count--;
121
+ if (cache.get(globe).get(ProgramClass).get(modeKey).count === 0) {
122
+ cache.get(globe).get(ProgramClass).get(modeKey).program.free();
123
+ cache.get(globe).get(ProgramClass).delete(modeKey);
124
+ if (cache.get(globe).get(ProgramClass).size === 0) {
125
+ cache.get(globe).delete(ProgramClass);
126
+ }
121
127
  }
122
128
  }
123
129
  }
@@ -169,18 +169,12 @@ class PointTracksPlugin {
169
169
  const wrapper = (selectedIDsSet) => {
170
170
  const selectedIDs = Array.from(selectedIDsSet);
171
171
  if (selectedIDs.length === 0) {
172
- this._selectedObj = null;
173
- this._selectedID = -1;
174
172
  callback([]);
175
173
  return;
176
174
  }
177
175
  const selectedPoints = [];
178
176
  for (let i = 0; i < selectedIDs.length; i++) {
179
177
  const id = selectedIDs[i];
180
- if (i === 0) {
181
- this._selectedID = id;
182
- this._selectedObj = objectStore.get(id);
183
- }
184
178
  const obj = objectStore.get(id);
185
179
  selectedPoints.push(obj);
186
180
  }
@@ -366,27 +360,38 @@ class PointTracksPlugin {
366
360
  this._tracksToPointsMap.delete(trackID);
367
361
  }
368
362
  }
369
- _selfSelect() {
370
- const { globe } = this;
371
- const pos = globe.api_GetMousePos();
372
- const x = pos.canvasX;
373
- const y = globe.api_ScrH() - pos.canvasY;
374
- this.screenSelection(x, y, (selectedPoints) => {
375
- if (selectedPoints.length > 0) {
376
- if (this._lastSelectedID !== this._selectedID) {
377
- this._lastSelectedID = this._selectedID;
378
- this._drawOptionsUBO.updateSingle("hovered_vertexID", this._selectedID);
379
- this.globe.DrawRender();
380
- }
381
- }
382
- else {
363
+ _updateHoverState(x, y) {
364
+ const { pointSizes, _pickerDisplayer } = this;
365
+ const objectStore = this._StorageManagersMap.get("objectStore").bufferManager;
366
+ const wrapper = (selectedIDsSet) => {
367
+ const selectedIDs = Array.from(selectedIDsSet);
368
+ if (selectedIDs.length === 0) {
369
+ this._selectedObj = null;
370
+ this._selectedID = -1;
383
371
  if (this._lastSelectedID !== -1) {
384
372
  this._lastSelectedID = -1;
385
373
  this._drawOptionsUBO.updateSingle("hovered_vertexID", -1);
386
374
  this.globe.DrawRender();
387
375
  }
376
+ return;
388
377
  }
389
- });
378
+ const id = selectedIDs[0];
379
+ this._selectedID = id;
380
+ this._selectedObj = objectStore.get(id);
381
+ if (this._lastSelectedID !== this._selectedID) {
382
+ this._lastSelectedID = this._selectedID;
383
+ this._drawOptionsUBO.updateSingle("hovered_vertexID", this._selectedID);
384
+ this.globe.DrawRender();
385
+ }
386
+ };
387
+ _pickerDisplayer.pickXY(x, y, pointSizes.selectionPointFilling, wrapper);
388
+ }
389
+ _selfSelect() {
390
+ const { globe } = this;
391
+ const pos = globe.api_GetMousePos();
392
+ const x = pos.canvasX;
393
+ const y = globe.api_ScrH() - pos.canvasY;
394
+ this._updateHoverState(x, y);
390
395
  }
391
396
  _turnOffFocus() {
392
397
  const { gl } = this;