@pirireis/webglobeplugins 0.16.1 → 0.16.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/package.json
CHANGED
|
@@ -47,18 +47,18 @@ export class ContextTexBulk {
|
|
|
47
47
|
doDraw;
|
|
48
48
|
keyAdapter;
|
|
49
49
|
textAdapter;
|
|
50
|
-
zoomLevelAdapter;
|
|
51
50
|
inputZoomAdapter;
|
|
51
|
+
textZoomLevelAdapter;
|
|
52
52
|
xOffset;
|
|
53
53
|
yOffset;
|
|
54
54
|
// private cameraTotem: CameraUniformBlockTotem;
|
|
55
55
|
angleOptions;
|
|
56
|
-
constructor(globe, keyAdapter, textAdapter,
|
|
56
|
+
constructor(globe, keyAdapter, textAdapter, inputZoomAdapter = (input, zoomLevel) => {
|
|
57
57
|
return {
|
|
58
58
|
opacityMultiplier: 1,
|
|
59
59
|
sizeMultiplier: 1
|
|
60
60
|
};
|
|
61
|
-
},
|
|
61
|
+
}, textZoomLevelAdapter = (zoomLevel) => (item) => {
|
|
62
62
|
return {
|
|
63
63
|
opacityMultiplier: 1,
|
|
64
64
|
sizeMultiplier: 1
|
|
@@ -77,7 +77,7 @@ export class ContextTexBulk {
|
|
|
77
77
|
this.angleOptions = angleOptions;
|
|
78
78
|
this.keyAdapter = keyAdapter;
|
|
79
79
|
this.textAdapter = textAdapter;
|
|
80
|
-
this.
|
|
80
|
+
this.textZoomLevelAdapter = textZoomLevelAdapter;
|
|
81
81
|
this.inputZoomAdapter = inputZoomAdapter;
|
|
82
82
|
this.xOffset = offset.x;
|
|
83
83
|
this.yOffset = offset.y;
|
|
@@ -110,28 +110,30 @@ export class ContextTexBulk {
|
|
|
110
110
|
const data = dataMap.values();
|
|
111
111
|
const zoomLevel = globe.api_GetCurrentLODWithDecimal();
|
|
112
112
|
// const zoomLevel = this.cameraTotem.getApproximatedLOD();
|
|
113
|
-
const zoomAdapter = this.
|
|
113
|
+
const zoomAdapter = this.textZoomLevelAdapter(zoomLevel);
|
|
114
114
|
for (const { input, tree } of data) {
|
|
115
|
-
const inputZoomResult = this.inputZoomAdapter(
|
|
116
|
-
if (inputZoomResult.sizeMultiplier
|
|
115
|
+
const inputZoomResult = this.inputZoomAdapter(input, zoomLevel);
|
|
116
|
+
if (inputZoomResult.sizeMultiplier <= 0 || inputZoomResult.opacityMultiplier <= 0)
|
|
117
117
|
continue;
|
|
118
118
|
// @ts-ignore
|
|
119
119
|
const itemsInBBox = tree.search({ minX: bbox.ll.x, minY: bbox.ll.y, maxX: bbox.ur.x, maxY: bbox.ur.y });
|
|
120
120
|
const itemsLen = itemsInBBox.length;
|
|
121
121
|
for (let i = 0; i < itemsLen; i++) {
|
|
122
122
|
const item = itemsInBBox[i];
|
|
123
|
-
const { lat, long, text, opacity = null, angle = null,
|
|
123
|
+
const { lat, long, text, opacity = null, angle = null, position, xOffsetLocal = xOffset, yOffsetLocal = yOffset } = item;
|
|
124
|
+
const { opacityMultiplier, sizeMultiplier } = zoomAdapter(item);
|
|
125
|
+
if (sizeMultiplier <= 0 || opacityMultiplier <= 0)
|
|
126
|
+
continue;
|
|
124
127
|
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
125
128
|
long: long,
|
|
126
129
|
lat: lat,
|
|
127
130
|
z: 0,
|
|
128
131
|
}, style.zMode === CSZMode.Z_MSL);
|
|
129
|
-
const { opacityMultiplier, sizeMultiplier } = zoomAdapter(zPayload);
|
|
130
132
|
const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier * inputZoomResult.opacityMultiplier;
|
|
131
133
|
textFont.size = sizeMultiplier * textSize * inputZoomResult.sizeMultiplier;
|
|
132
134
|
textFont.position = position;
|
|
133
135
|
if (x !== null && y !== null)
|
|
134
|
-
globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x +
|
|
136
|
+
globe.api_DrawContextTextMultiLine(text, textFont, o, { x: x + xOffsetLocal, y: y - yOffsetLocal }, angleIsOn, angle);
|
|
135
137
|
}
|
|
136
138
|
textFont.size = textSize;
|
|
137
139
|
}
|
|
@@ -91,14 +91,16 @@ export class ContextTextWriter4 {
|
|
|
91
91
|
const zoomLevel = globe.api_GetCurrentLODWithDecimal();
|
|
92
92
|
const zoomAdapter = this.zoomLevelAdapter(zoomLevel);
|
|
93
93
|
for (const item of itemMap.values()) {
|
|
94
|
-
const { lat, long, text, opacity = null, angle = null,
|
|
94
|
+
const { lat, long, text, opacity = null, angle = null, position } = item;
|
|
95
|
+
const { opacityMultiplier, sizeMultiplier } = zoomAdapter(item);
|
|
96
|
+
if (sizeMultiplier <= 0 || opacityMultiplier <= 0)
|
|
97
|
+
continue;
|
|
98
|
+
const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
|
|
95
99
|
const { x, y } = globe.api_GetScreenPointFromGeo({
|
|
96
100
|
long: long,
|
|
97
101
|
lat: lat,
|
|
98
102
|
z: 0,
|
|
99
103
|
}, style.zMode === CSZMode.Z_MSL);
|
|
100
|
-
const { opacityMultiplier, sizeMultiplier } = zoomAdapter(zPayload);
|
|
101
|
-
const o = (opacity === null ? opacity_ : opacity * opacity_) * opacityMultiplier;
|
|
102
104
|
textFont.size = sizeMultiplier * textSize;
|
|
103
105
|
textFont.position = position;
|
|
104
106
|
if (x !== null && y !== null)
|