@pirireis/webglobeplugins 0.6.9 → 0.6.10
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
|
@@ -293,7 +293,7 @@ export default class Plugin {
|
|
|
293
293
|
updatePartial(items, propertyIDs = [], textWriterInjectionSubSetIDs = []) { // textWriterInjectionSubSetIDs = []
|
|
294
294
|
if (propertyIDs.length === 0) console.warn("updatePartial is called with no target propertyIDs");
|
|
295
295
|
const { _textContextInjectionMap, bufferOrchestrator, bufferManagersCompMap } = this;
|
|
296
|
-
const writers = textWriterGetOrThrow(this._textContextInjectionMap, textWriterInjectionSubSetIDs);
|
|
296
|
+
const writers = textWriterGetOrThrow(this._textContextInjectionMap, textWriterInjectionSubSetIDs);
|
|
297
297
|
for (let item of items) { this._insertTexts(item, writers) }
|
|
298
298
|
bufferOrchestrator.updateBulk(items, bufferManagersCompMap, propertyIDs);
|
|
299
299
|
// patch to update text opacity
|
package/package.json
CHANGED
|
@@ -54,7 +54,12 @@ void main() {
|
|
|
54
54
|
gl_Position = cartesian3DToGLPosition(position);
|
|
55
55
|
v_limp = vec2(0.0, 0.0);
|
|
56
56
|
} else {
|
|
57
|
-
vec2 position
|
|
57
|
+
vec2 position;
|
|
58
|
+
if (radius < 250.0) {
|
|
59
|
+
position = circleLimpFromLongLatRadCenterMercatorCompass( center_position, radius, angle);
|
|
60
|
+
} else {
|
|
61
|
+
position = circleLimpFromLongLatRadCenterMercatorRealDistance( center_position, radius, angle);
|
|
62
|
+
}
|
|
58
63
|
v_limp = position;
|
|
59
64
|
gl_Position = mercatorXYToGLPosition( position);
|
|
60
65
|
|
package/util/check/typecheck.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
// Generic
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const doesOwnProperties = (properties, errorMessage) => {
|
|
4
|
+
return (object) => {
|
|
5
|
+
properties.forEach(element => {
|
|
6
|
+
if (!Object.hasOwn(object, element)) throw new TypeError(errorMessage + ':' + element);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const isHexColor = (hexColor) => /^#[0-9A-F]{6}$/i.test(hexColor);
|
|
10
12
|
export const isHexColorWithOpacity = (hexColor) => /^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(hexColor);
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
export const opacityCheck = (opacity) => {
|
|
15
|
+
if (typeof opacity !== "number") throw new TypeError("style.opacity must a number");
|
|
16
|
+
if (opacity < 0 || 1 < opacity) throw new RangeError("Opacity Range Must be 0-1");
|
|
17
|
+
}
|
|
13
18
|
// Text Related
|
|
14
19
|
|
|
15
20
|
const fontCheckTypes = doesOwnProperties(["name", "textColor", "hollowColor", "size", "bold", "italic"], "font does not have");
|
|
@@ -17,7 +22,7 @@ const fontCheckColors = (textColor, hollowColor) => isHexColor(textColor) && isH
|
|
|
17
22
|
export const isTextFont = (textFont) => {
|
|
18
23
|
fontCheckTypes(textFont);
|
|
19
24
|
fontCheckColors(textFont.textColor, textFont.hollowColor);
|
|
20
|
-
if (
|
|
25
|
+
if (typeof textFont.size !== "number") throw new TypeError("textFont size is not a number");
|
|
21
26
|
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CSZMode } from "@pirireis/webglobe";
|
|
2
|
+
import { isTextFont, opacityCheck } from "../util/check/typecheck";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TODOs:
|
|
@@ -39,9 +40,8 @@ export class ContextTextWriter3 {
|
|
|
39
40
|
} = {}) {
|
|
40
41
|
this.globe = globe;
|
|
41
42
|
this.itemMap = new Map();
|
|
42
|
-
this.style
|
|
43
|
+
this.setStyle(style);
|
|
43
44
|
this.doDraw = doDraw;
|
|
44
|
-
|
|
45
45
|
this._checkParameterTypes(textAdaptor, coordinatesAdaptor, keyAdaptor, opacityAdaptor, angleAdaptor, xOffset, yOffset);
|
|
46
46
|
|
|
47
47
|
this.textAdaptor = textAdaptor;
|
|
@@ -83,6 +83,8 @@ export class ContextTextWriter3 {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
setStyle(style) {
|
|
86
|
+
isTextFont(style.textFont);
|
|
87
|
+
opacityCheck(style.opacity);
|
|
86
88
|
this.style = style;
|
|
87
89
|
}
|
|
88
90
|
|
package/write-text/util.js
DELETED