@pirireis/webglobeplugins 1.2.10 → 1.2.12
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
|
@@ -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.
|
|
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,34 @@ export class TerrainPolygonSemiPlugin {
|
|
|
225
226
|
this.globe.DrawRender();
|
|
226
227
|
}
|
|
227
228
|
setUsePickedColorState(state, target = "polygon") {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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");
|
|
230
|
+
}
|
|
231
|
+
setOpacity() {
|
|
232
|
+
throw new Error("use setOpacities instead");
|
|
235
233
|
}
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
this.
|
|
240
|
-
this._uboForRealEdgeArcs?.updateSingle("opacity", this._effectiveOpacity("edgeArc"));
|
|
241
|
-
this.globe.DrawRender();
|
|
234
|
+
setOpacities(opacities) {
|
|
235
|
+
if (opacities.common !== undefined) {
|
|
236
|
+
opacityCheck(opacities.common);
|
|
237
|
+
this._options.opacity = opacities.common;
|
|
242
238
|
}
|
|
239
|
+
if (opacities.polygon !== undefined) {
|
|
240
|
+
opacityCheck(opacities.polygon);
|
|
241
|
+
this._options.polygonStyle.opacity = opacities.polygon;
|
|
242
|
+
}
|
|
243
|
+
if (opacities.edgeArc !== undefined) {
|
|
244
|
+
opacityCheck(opacities.edgeArc);
|
|
245
|
+
this._options.edgeStyle.opacity = opacities.edgeArc;
|
|
246
|
+
}
|
|
247
|
+
this._uboHandler.updateSingle("opacity", this._effectiveOpacity("polygon"));
|
|
248
|
+
this._uboForRealEdgeArcs?.updateSingle("opacity", this._effectiveOpacity("edgeArc"));
|
|
249
|
+
this.globe.DrawRender();
|
|
243
250
|
}
|
|
244
251
|
setChangeColorOnHoverState(state, target = "polygon") {
|
|
245
252
|
const oldState = this._options[`${target}Style`].changeHoverColor;
|
|
246
253
|
if (oldState === state)
|
|
247
254
|
return;
|
|
248
255
|
this._options[`${target}Style`].changeHoverColor = state;
|
|
249
|
-
const ubo = this.
|
|
256
|
+
const ubo = this._getUBO(target);
|
|
250
257
|
ubo.updateSingle("private_changeHoverColor", new Float32Array([state ? 1 : 0]));
|
|
251
258
|
this.globe.DrawRender();
|
|
252
259
|
}
|
|
@@ -432,7 +439,7 @@ export class TerrainPolygonSemiPlugin {
|
|
|
432
439
|
this.insertBulk(TestRecords.get(recordName));
|
|
433
440
|
}
|
|
434
441
|
}
|
|
435
|
-
|
|
442
|
+
_getUBO(target = "polygon") {
|
|
436
443
|
let targetUBO;
|
|
437
444
|
if (target === "polygon") {
|
|
438
445
|
targetUBO = this._uboHandler;
|
|
@@ -441,7 +448,7 @@ export class TerrainPolygonSemiPlugin {
|
|
|
441
448
|
targetUBO = this._uboForRealEdgeArcs;
|
|
442
449
|
}
|
|
443
450
|
else {
|
|
444
|
-
throw new Error(`unknown target ${target} for
|
|
451
|
+
throw new Error(`unknown target ${target} for _getUBO, must be "polygon" or "edgeArc"`);
|
|
445
452
|
}
|
|
446
453
|
return targetUBO;
|
|
447
454
|
}
|