@pirireis/webglobeplugins 1.2.10 → 1.2.11

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.2.10",
3
+ "version": "1.2.11",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@ import { PickerDisplayer } from "../../../util/picking/picker-displayer";
5
5
  import { IndexPolygonMap } from "./data/index-polygon-map";
6
6
  import { TestRecords } from "./test-records";
7
7
  import { defaultblendfunction } from "../../../util/globe-default-gl-states";
8
+ import { opacityCheck } from "../../../util/check/typecheck";
8
9
  export class TerrainPolygonSemiPlugin {
9
10
  id;
10
11
  globe = null;
@@ -184,7 +185,7 @@ export class TerrainPolygonSemiPlugin {
184
185
  throw new Error(`Cannot set private uniform ${name}`);
185
186
  }
186
187
  const isStyleKey = name === "defaultColor" || name === "hoverColor" || name === "opacity" || name === "useDefaultColor";
187
- const ubo = this.__getUBO(target);
188
+ const ubo = this._getUBO(target);
188
189
  if (isStyleKey) {
189
190
  const prev = this._options.polygonStyle[name];
190
191
  if (prev === value)
@@ -225,28 +226,31 @@ export class TerrainPolygonSemiPlugin {
225
226
  this.globe.DrawRender();
226
227
  }
227
228
  setUsePickedColorState(state, target = "polygon") {
228
- const oldState = this._options[`${target}Style`].changePickedColor;
229
- if (oldState === state)
230
- return;
231
- this._options[`${target}Style`].changePickedColor = state;
232
- const ubo = this.__getUBO(target);
233
- ubo.updateSingle("private_changeHoverColor", new Float32Array([state ? 1 : 0]));
234
- this.globe.DrawRender();
229
+ throw new Error("use setChangeColorOnHoverState instead");
235
230
  }
236
- setOpacity(opacity) {
237
- if (this._options.opacity !== opacity) {
238
- this._options.opacity = opacity;
239
- this._uboHandler.updateSingle("opacity", this._effectiveOpacity("polygon"));
240
- this._uboForRealEdgeArcs?.updateSingle("opacity", this._effectiveOpacity("edgeArc"));
241
- this.globe.DrawRender();
231
+ setOpacity(opacities) {
232
+ if (opacities.common !== undefined) {
233
+ opacityCheck(opacities.common);
234
+ this._options.opacity = opacities.common;
242
235
  }
236
+ if (opacities.polygon !== undefined) {
237
+ opacityCheck(opacities.polygon);
238
+ this._options.polygonStyle.opacity = opacities.polygon;
239
+ }
240
+ if (opacities.edgeArc !== undefined) {
241
+ opacityCheck(opacities.edgeArc);
242
+ this._options.edgeStyle.opacity = opacities.edgeArc;
243
+ }
244
+ this._uboHandler.updateSingle("opacity", this._effectiveOpacity("polygon"));
245
+ this._uboForRealEdgeArcs?.updateSingle("opacity", this._effectiveOpacity("edgeArc"));
246
+ this.globe.DrawRender();
243
247
  }
244
248
  setChangeColorOnHoverState(state, target = "polygon") {
245
249
  const oldState = this._options[`${target}Style`].changeHoverColor;
246
250
  if (oldState === state)
247
251
  return;
248
252
  this._options[`${target}Style`].changeHoverColor = state;
249
- const ubo = this.__getUBO(target);
253
+ const ubo = this._getUBO(target);
250
254
  ubo.updateSingle("private_changeHoverColor", new Float32Array([state ? 1 : 0]));
251
255
  this.globe.DrawRender();
252
256
  }
@@ -432,7 +436,7 @@ export class TerrainPolygonSemiPlugin {
432
436
  this.insertBulk(TestRecords.get(recordName));
433
437
  }
434
438
  }
435
- __getUBO(target = "polygon") {
439
+ _getUBO(target = "polygon") {
436
440
  let targetUBO;
437
441
  if (target === "polygon") {
438
442
  targetUBO = this._uboHandler;
@@ -441,7 +445,7 @@ export class TerrainPolygonSemiPlugin {
441
445
  targetUBO = this._uboForRealEdgeArcs;
442
446
  }
443
447
  else {
444
- throw new Error(`unknown target ${target} for __getUBO, must be "polygon" or "edgeArc"`);
448
+ throw new Error(`unknown target ${target} for _getUBO, must be "polygon" or "edgeArc"`);
445
449
  }
446
450
  return targetUBO;
447
451
  }