@pirireis/webglobeplugins 0.6.5 → 0.6.7
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
|
@@ -30,7 +30,7 @@ export default class Plugin {
|
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
32
|
* @param {*} id
|
|
33
|
-
* @param {Map<[K ,ContextTextWriter]} textContextInjectionMap import { ContextTextWriter } from '@pirireis/webglobeplugins/write-text/context-text';
|
|
33
|
+
* @param {Map<[K ,{writer:ContextTextWriter, coordsAdaptor, textAdaptor}]} textContextInjectionMap import { ContextTextWriter } from '@pirireis/webglobeplugins/write-text/context-text';
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
|
|
@@ -38,6 +38,7 @@ export default class Plugin {
|
|
|
38
38
|
this.id = id;
|
|
39
39
|
this._opacity = opacity;
|
|
40
40
|
this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
|
|
41
|
+
this._checkTextContextInjectionMap(textContextInjectionMap);
|
|
41
42
|
this._textContextInjectionMap = textContextInjectionMap;
|
|
42
43
|
this.drawVRM = drawVRM;
|
|
43
44
|
this.drawBearingLine = drawBearingLine;
|
|
@@ -63,6 +64,15 @@ export default class Plugin {
|
|
|
63
64
|
this.globe.DrawRender();
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
_checkTextContextInjectionMap(textContextInjectionMap) {
|
|
68
|
+
if (!(textContextInjectionMap instanceof Map)) throw new Error("textContextInjectionMap is not instance of Map");
|
|
69
|
+
textContextInjectionMap.forEach((v) => {
|
|
70
|
+
if (typeof v !== 'object') throw new Error("textContextInjectionMap format is wrong");
|
|
71
|
+
if (typeof v.coordsAdaptor !== 'function') throw new Error("textContextInjectionMap coordsAdaptor format is wrong");
|
|
72
|
+
if (typeof v.textAdaptor !== 'function') throw new Error("textContextInjectionMap textAdaptor format is wrong");
|
|
73
|
+
if (!(v.writer instanceof ContextTextWriter)) throw new Error("textContextInjectionMap writer is not instance of ContextTextWriter");
|
|
74
|
+
})
|
|
75
|
+
}
|
|
66
76
|
|
|
67
77
|
setDoDrawAngleRing(bool) {
|
|
68
78
|
if (bool === this.drawAngleRing) return;
|
|
@@ -55,7 +55,7 @@ export class ChainListMap {
|
|
|
55
55
|
const deleteKeys = [];
|
|
56
56
|
const removeSet = new Set(nodeKeys);
|
|
57
57
|
const newChain = []
|
|
58
|
-
for (let i = 0; i < chain.length; i++) {
|
|
58
|
+
for (let i = 0; i < chain.length - 1; i++) {
|
|
59
59
|
const node = chain[i];
|
|
60
60
|
const dKey = node.__identity__;
|
|
61
61
|
this._indexMap.delete(dKey);
|
|
@@ -67,6 +67,7 @@ export class ChainListMap {
|
|
|
67
67
|
}
|
|
68
68
|
{ // last item case
|
|
69
69
|
const lastItem = chain[chain.length - 1];
|
|
70
|
+
this._indexMap.delete(lastItem.__identity__);
|
|
70
71
|
if (removeSet.has(lastItem.key)) {
|
|
71
72
|
if (chain.length > 1) {
|
|
72
73
|
deleteKeys.push(chain[chain.length - 2].__identity__);
|
|
@@ -3,6 +3,7 @@ import { CircleCache } from '../programs/line-on-globe/circle';
|
|
|
3
3
|
import { BufferOrchestrator, BufferManager } from "../util/account";
|
|
4
4
|
import { ChainListMap } from "./chain-list-map";
|
|
5
5
|
import { keyMethod } from "./util";
|
|
6
|
+
import { ContextTextWriter3 } from '../write-text/context-text3';
|
|
6
7
|
// TODO: Add update buffer and update text mehods on add, delete, update methods
|
|
7
8
|
|
|
8
9
|
|
|
@@ -62,6 +63,12 @@ export class CircleLineChainPlugin {
|
|
|
62
63
|
this._initOrchestrations()
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
_checkTextContextWriterInjectionMap(textContextWriterInjectionMap) {
|
|
67
|
+
if (!(textContextWriterInjectionMap instanceof Map)) throw new Error("textContextWriterInjectionMap is not an instance of Map");
|
|
68
|
+
textContextWriterInjectionMap.forEach((v) => {
|
|
69
|
+
if (!(v instanceof ContextTextWriter3)) throw new Error("textContextWriterInjectionMap element is not an instance of ContextTextWriter3");
|
|
70
|
+
});
|
|
71
|
+
}
|
|
65
72
|
|
|
66
73
|
_initOrchestrations() {
|
|
67
74
|
const { gl, globe } = this;
|