@pirireis/webglobeplugins 0.5.6 → 0.5.8

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.
@@ -48,19 +48,14 @@ export class ChainListMap {
48
48
  this._resetIndexChain(chainKey);
49
49
  }
50
50
 
51
- deleteNode(chainKey, nodeKey) {
52
- const index = this.getIndexOfNode(chainKey, nodeKey);
53
- const chain = this._chainMap.get(chainKey);
54
- chain.splice(index, 1);
55
- this._resetIndexChain(chainKey);
56
- }
57
51
 
58
52
  deleteNodesBelongToAChain(chainKey, nodeKeys) {
59
53
  const chain = this._chainMap.get(chainKey);
60
54
  const deleteKeys = [];
61
55
  const removeSet = new Set(nodeKeys);
62
56
  const newChain = []
63
- for (const node of chain) {
57
+ for (let i = 0; i < chain.length - 1; i++) {
58
+ const node = chain[i];
64
59
  const dKey = node.__identity__;
65
60
  this._indexMap.delete(dKey);
66
61
  if (removeSet.has(node.key)) {
@@ -69,6 +64,18 @@ export class ChainListMap {
69
64
  newChain.push(node);
70
65
  }
71
66
  }
67
+ { // last item case
68
+ const lastItem = chain[chain.length - 1];
69
+ if (removeSet.has(lastItem.key)) {
70
+ this._indexMap.delete(lastItem.__identity__);
71
+ if (chain.length > 1) {
72
+ deleteKeys.push(chain[chain.length - 2].__identity__);
73
+ deleteKeys.push(chain[chain.length - 1].__identity__);
74
+ };
75
+ } else {
76
+ newChain.push(lastItem);
77
+ }
78
+ }
72
79
  this._chainMap.set(chainKey, newChain);
73
80
  return deleteKeys;
74
81
  }
@@ -163,7 +170,6 @@ export class ChainListMap {
163
170
  if (!chain) return;
164
171
  const properties = this._chainSideProperties.get(chainKey);
165
172
  textWriterObjs.forEach((writer) => {
166
-
167
173
  writer.insertTextBulk(chain, properties);
168
174
  });
169
175
 
@@ -166,7 +166,7 @@ export class CircleLineChainPlugin {
166
166
  updateNodeProperties(chainKey, nodesAndPropertyMap, { textWriterIDs = [] } = {}) {
167
167
  this._chainListMap.updateNodeProperties(chainKey, nodesAndPropertyMap)
168
168
  this._reconstructChains([chainKey]);
169
- this._textUpdate(chainKey, textWriterIDs);
169
+ this._updateTexts(chainKey, textWriterIDs);
170
170
  this.globe.DrawRender();
171
171
  }
172
172
 
@@ -271,7 +271,7 @@ export class CircleLineChainPlugin {
271
271
 
272
272
  /**
273
273
  *
274
- * @param {Array<{key, nodeKeys:[]} keysAndNodes
274
+ * @param {Array<{chainKey, nodeKeys:[]} keysAndNodes
275
275
  */
276
276
  deleteNodes(keysAndNodes) {
277
277
  const bufferKeys = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"