@pirireis/webglobeplugins 0.3.2 → 0.3.4
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/bearing-line/plugin.js
CHANGED
|
@@ -9,6 +9,13 @@ export const RINGPARTIAL_DRAW_MODE = Object.freeze({
|
|
|
9
9
|
TRIANGLE_FAN: "TRIANGLE_FAN",
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
+
const constraintFloat = (x, lowerBound, upperBound) => {
|
|
13
|
+
if (typeof x !== "number") throw new Error("type must be numberic")
|
|
14
|
+
if (lowerBound > x || x > upperBound) throw new Error(`input must be between ${lowerBound} - ${upperBound}`)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
12
19
|
|
|
13
20
|
/**
|
|
14
21
|
* @typedef {Object}textContextInjection
|
|
@@ -33,6 +40,31 @@ export default class Plugin {
|
|
|
33
40
|
this.drawText = drawText;
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
setDoDrawVRM(bool) {
|
|
44
|
+
if (bool === this.drawVRM) return;
|
|
45
|
+
this.drawVRM = bool;
|
|
46
|
+
this.globe.DrawRender();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setDoDrawText(bool) {
|
|
50
|
+
if (bool === this.drawText) return;
|
|
51
|
+
this.drawText = bool;
|
|
52
|
+
this.globe.DrawRender();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setDoDrawText(bool) {
|
|
56
|
+
if (bool === this.drawText) return;
|
|
57
|
+
this.drawText = bool;
|
|
58
|
+
this.globe.DrawRender();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
setDoDrawAngleRing(bool) {
|
|
63
|
+
if (bool === this.drawAngleRing) return;
|
|
64
|
+
this.drawAngleRing = bool;
|
|
65
|
+
this.globe.DrawRender();
|
|
66
|
+
}
|
|
67
|
+
|
|
36
68
|
|
|
37
69
|
settextContextInjectionMap(textContextInjectionMap, data = null) {
|
|
38
70
|
this._textContextInjectionMap = textContextInjectionMap;
|
|
@@ -46,6 +78,7 @@ export default class Plugin {
|
|
|
46
78
|
|
|
47
79
|
|
|
48
80
|
setOpacity(opacity) {
|
|
81
|
+
constraintFloat(opacity, 0, 1);
|
|
49
82
|
this._opacity = opacity;
|
|
50
83
|
this._textContextInjectionMap.forEach(({ writer }) => writer.setOpacity(opacity));
|
|
51
84
|
this.globe.DrawRender();
|
package/package.json
CHANGED
|
@@ -66,6 +66,7 @@ void main() {
|
|
|
66
66
|
if (v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE) { discard; }
|
|
67
67
|
color = v_color;
|
|
68
68
|
color.a *= opacity;
|
|
69
|
+
if ( v_dash_ratio >= 1.0 ) { return; }
|
|
69
70
|
if (interpolation > 0.95) { return; }
|
|
70
71
|
if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a /= 4.0; }
|
|
71
72
|
|
|
@@ -22,6 +22,10 @@ export class ContextTextWriter {
|
|
|
22
22
|
this.doDraw = doDraw;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
setDoDraw(bool) {
|
|
26
|
+
this.doDraw = bool;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
setStyle(style) {
|
|
26
30
|
this.style = style;
|
|
27
31
|
}
|
|
@@ -34,6 +38,7 @@ export class ContextTextWriter {
|
|
|
34
38
|
this.doDraw = boolean;
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
|
|
37
42
|
draw() {
|
|
38
43
|
if (!this.doDraw) return;
|
|
39
44
|
const { globe, style, itemMap } = this;
|