@pirireis/webglobeplugins 0.6.42-a → 0.6.43-a
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 +20 -6
- package/circle-line-chain/plugin.js +11 -4
- package/package.json +1 -1
- package/rangerings/plugin.js +17 -7
package/bearing-line/plugin.js
CHANGED
|
@@ -28,7 +28,7 @@ export default class BearingLinePlugin {
|
|
|
28
28
|
{
|
|
29
29
|
opacity = 1,
|
|
30
30
|
textWritersMap = new Map(),
|
|
31
|
-
textDataPreAdaptor =
|
|
31
|
+
textDataPreAdaptor = (x) => x,
|
|
32
32
|
drawVRM = true,
|
|
33
33
|
drawBearingLine = true,
|
|
34
34
|
drawAngleRing = true,
|
|
@@ -118,11 +118,25 @@ export default class BearingLinePlugin {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
/**
|
|
122
|
+
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
123
|
+
* @param {Array<string>} itemKeys | if empty, all texts will be updated.
|
|
124
|
+
*/
|
|
125
|
+
updateText(textWriterIDs = [], itemKeys = null) {
|
|
122
126
|
const textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
if (itemKeys === null) {
|
|
128
|
+
this._memoryForText.forEach((item) => {
|
|
129
|
+
let _item = this._textDataPreAdaptor(item);
|
|
130
|
+
textWritersMap.forEach((writer) => writer.insertText(_item));
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
itemKeys.forEach((key) => {
|
|
134
|
+
let item = this._memoryForText.get(key);
|
|
135
|
+
if (item === undefined) return;
|
|
136
|
+
let _item = this._textDataPreAdaptor(item);
|
|
137
|
+
textWritersMap.forEach((writer) => writer.insertText(_item));
|
|
138
|
+
});
|
|
139
|
+
}
|
|
126
140
|
this.globe.DrawRender();
|
|
127
141
|
}
|
|
128
142
|
|
|
@@ -193,8 +207,8 @@ export default class BearingLinePlugin {
|
|
|
193
207
|
for (const item of items) {
|
|
194
208
|
const oldItem = this._memoryForText.get(item.key);
|
|
195
209
|
let _item = oldItem !== undefined ? { ...oldItem, ...item } : item;
|
|
196
|
-
if (this._textDataPreAdaptor !== null) _item = this._textDataPreAdaptor(_item);
|
|
197
210
|
this._memoryForText.set(item.key, _item);
|
|
211
|
+
if (this._textDataPreAdaptor !== null) _item = this._textDataPreAdaptor(_item);
|
|
198
212
|
textWritersMap.forEach((writer) => writer.insertText(_item));
|
|
199
213
|
}
|
|
200
214
|
}
|
|
@@ -126,9 +126,16 @@ export class CircleLineChainPlugin {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {Array<string>} textWriterIDs | textWritersMap keys to be used for writing text.
|
|
134
|
+
* @param {Array<string>} chainKeys | if empty, all texts will be updated
|
|
135
|
+
*/
|
|
136
|
+
updateText(textWriterIDs = [], chainKeys = null) {
|
|
137
|
+
if (chainKeys === null) chainKeys = this._chainListMap.getAllChainKeysIterator();
|
|
138
|
+
this._updateTexts(chainKeys, textWriterIDs);
|
|
132
139
|
this.globe.DrawRender();
|
|
133
140
|
}
|
|
134
141
|
|
|
@@ -354,7 +361,7 @@ export class CircleLineChainPlugin {
|
|
|
354
361
|
const textWriters = textWriterGetOrThrow(this._textWritersMap, textWriterIDs)
|
|
355
362
|
chainKeys.forEach((chainKey) => {
|
|
356
363
|
this._chainListMap.textUpdate(chainKey, textWriters, this._textDataPreAdaptor);
|
|
357
|
-
})
|
|
364
|
+
});
|
|
358
365
|
}
|
|
359
366
|
|
|
360
367
|
|
package/package.json
CHANGED
package/rangerings/plugin.js
CHANGED
|
@@ -51,7 +51,7 @@ import { LinesColorInstancedFlatCache } from "../programs/line-on-globe/lines-co
|
|
|
51
51
|
import { BufferOrchestrator, BufferManager } from "../util/account";
|
|
52
52
|
import { mapGetOrThrow } from "../util/check/get";
|
|
53
53
|
import { populateFloat32Array } from "../util/jshelpers/data-filler";
|
|
54
|
-
import { RingAccount, ringBigPaddingKeyMethod } from "./ring-account";
|
|
54
|
+
import { RingAccount, ringBigPaddingKeyMethod, ringKeyMethod } from "./ring-account";
|
|
55
55
|
import { CirclePadding3DCache } from "../programs/line-on-globe/degree-padding-around-circle-3d";
|
|
56
56
|
import { LineOnGlobeCache } from '../programs/line-on-globe/naive-accurate';
|
|
57
57
|
import RangeRingAngleText from "./rangeringangletext";
|
|
@@ -217,16 +217,26 @@ class RangeRings {
|
|
|
217
217
|
* 2. delete from buffer orchestators
|
|
218
218
|
* 3. mark centers as hidden
|
|
219
219
|
*/
|
|
220
|
-
|
|
221
220
|
}
|
|
222
221
|
|
|
223
222
|
|
|
224
223
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
|
|
224
|
+
* @param {Array<string>} textWriterIDs textWritersMap keys to be used for writing text.
|
|
225
|
+
* @param {Array<string>} itemKeys if empty, all texts will be updated. Use {@link ringKeyMethod} method to get keys
|
|
226
|
+
*/
|
|
227
|
+
updateText(textWriterIDs = [], itemKeys = null) {
|
|
228
228
|
const textWritersMap = textWriterGetOrThrow(this._textWritersMap, textWriterIDs);
|
|
229
|
-
|
|
229
|
+
if (itemKeys === null) {
|
|
230
|
+
this._ringAccount.updateAllText(textWritersMap, this._textDataPreAdaptor);
|
|
231
|
+
this.globe.DrawRender();
|
|
232
|
+
} else {
|
|
233
|
+
itemKeys.forEach((key) => {
|
|
234
|
+
const item = this._ringAccount.getCenter(key);
|
|
235
|
+
if (item === undefined) throw new Error("Center not found");
|
|
236
|
+
const textData = this._textDataPreAdaptor(item);
|
|
237
|
+
textWritersMap.forEach((textWriter) => textWriter.insertText(textData));
|
|
238
|
+
});
|
|
239
|
+
}
|
|
230
240
|
this.globe.DrawRender();
|
|
231
241
|
}
|
|
232
242
|
|
|
@@ -272,7 +282,7 @@ class RangeRings {
|
|
|
272
282
|
* @method setOpacity @param { number } opacity
|
|
273
283
|
*/
|
|
274
284
|
setOpacity(opacity) {
|
|
275
|
-
if (typeof opacity !== "number" || opacity < 0 || opacity > 1) throw new Error("Invalid opacity
|
|
285
|
+
if (typeof opacity !== "number" || opacity < 0 || opacity > 1) throw new Error("Invalid value for opacity");
|
|
276
286
|
this._opacity = opacity;
|
|
277
287
|
this.textPlugin?.setOpacity(opacity);
|
|
278
288
|
this._textWritersMap.forEach((writer) => writer.setOpacity(opacity));
|