@pirireis/webglobeplugins 0.5.7 → 0.5.9

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.
@@ -68,9 +68,7 @@ export class ChainListMap {
68
68
  const lastItem = chain[chain.length - 1];
69
69
  if (removeSet.has(lastItem.key)) {
70
70
  this._indexMap.delete(lastItem.__identity__);
71
- console.log("lastItem", lastItem);
72
71
  if (chain.length > 1) {
73
- console.log(chain[chain.length - 2])
74
72
  deleteKeys.push(chain[chain.length - 2].__identity__);
75
73
  deleteKeys.push(chain[chain.length - 1].__identity__);
76
74
  };
@@ -78,7 +76,6 @@ export class ChainListMap {
78
76
  newChain.push(lastItem);
79
77
  }
80
78
  }
81
- console.log("deleteKeys");
82
79
  this._chainMap.set(chainKey, newChain);
83
80
  return deleteKeys;
84
81
  }
@@ -98,15 +95,21 @@ export class ChainListMap {
98
95
  }
99
96
 
100
97
 
101
- updateNodeProperties(node, chainKey) {
102
- const index = this.getIndexOfNode(chainKey, node.key)
103
- const chainNode = this._chainMap.get(chainKey)[index];
104
- if (node.circleProperties) {
105
- node.circleProperties.forEach((value, key, container) => chainNode[key] = value);
106
- }
107
- if (node.lineProperties) {
108
- node.lineProperties.forEach((value, key, container) => chainNode[key] = value);
109
- }
98
+ updateNodesProperties(chainKey, nodes) {
99
+ nodes.forEach((node) => {
100
+
101
+ const index = this.getIndexOfNode(chainKey, node.key)
102
+ const chainNode = this._chainMap.get(chainKey)[index];
103
+ if (node.circleProperties) {
104
+ if (chainNode.circleProperties === undefined) chainNode.circleProperties = {}
105
+ node.circleProperties.forEach((value, key, container) => chainNode.circleProperties[key] = value);
106
+ }
107
+ if (node.lineProperties) {
108
+ if (chainNode.lineProperties === undefined) chainNode.lineProperties = {}
109
+ node.lineProperties.forEach((value, key, container) => chainNode.lineProperties[key] = value);
110
+ }
111
+ });
112
+
110
113
  }
111
114
 
112
115
  updateCoordsinatesOfNode(node, chainKey) {
@@ -170,7 +173,6 @@ export class ChainListMap {
170
173
  */
171
174
  textUpdate(chainKey, textWriterObjs) {
172
175
  const chain = this._chainMap.get(chainKey);
173
- console.log(chainKey, this._chainMap, "chain", chain)
174
176
  if (!chain) return;
175
177
  const properties = this._chainSideProperties.get(chainKey);
176
178
  textWriterObjs.forEach((writer) => {
@@ -183,7 +185,6 @@ export class ChainListMap {
183
185
  getIndexOfNode(chainKey, nodeKey) {
184
186
  const key = this.keyMethod(chainKey, nodeKey);
185
187
  if (this._indexMap.has(key)) return this._indexMap.get(key);
186
-
187
188
  const chain = this._chainMap.get(chainKey);
188
189
  for (let i = 0; i < chain.length; i++) {
189
190
  const node = chain[i];
@@ -161,12 +161,12 @@ export class CircleLineChainPlugin {
161
161
  /**
162
162
  *
163
163
  * @param {*} chainKey
164
- * @param {Array<{nodeKey, Map[propertyName ,value]}} propertyMap
164
+ * @param {Array<{nodeKey, circleProperties:Map[propertyName ,value], lineProperties:Map[propertyName ,value] }} propertyMap
165
165
  */
166
- updateNodeProperties(chainKey, nodesAndPropertyMap, { textWriterIDs = [] } = {}) {
167
- this._chainListMap.updateNodeProperties(chainKey, nodesAndPropertyMap)
166
+ updateNodesProperties(chainKey, nodesAndPropertyMap, { textWriterIDs = [] } = {}) {
167
+ this._chainListMap.updateNodesProperties(chainKey, nodesAndPropertyMap)
168
168
  this._reconstructChains([chainKey]);
169
- this._updateTexts(chainKey, textWriterIDs);
169
+ this._updateTexts([chainKey], textWriterIDs);
170
170
  this.globe.DrawRender();
171
171
  }
172
172
 
@@ -231,7 +231,7 @@ export class CircleLineChainPlugin {
231
231
 
232
232
 
233
233
  updateNodeCoordinates(node, chainKey, { textWriterIDs = [] } = {}) {
234
- this._chainListMap.updateNode(node, chainKey);
234
+ this._chainListMap.updateCoordsinatesOfNode(node, chainKey);
235
235
  if (textWriterIDs) this._updateTexts([chainKey], textWriterIDs);
236
236
  this._reconstructChains([chainKey]);
237
237
  this.globe.DrawRender();
@@ -273,17 +273,18 @@ export class CircleLineChainPlugin {
273
273
  *
274
274
  * @param {Array<{chainKey, nodeKeys:[]} keysAndNodes
275
275
  */
276
- deleteNodes(keysAndNodes) {
276
+ deleteNodes(keysAndNodes, { textWriterIDs = [] } = {}) {
277
277
  const bufferKeys = [];
278
278
  const chainKeysToReconstuct = [];
279
279
  keysAndNodes.forEach(({ chainKey, nodeKeys }) => {
280
280
  bufferKeys.push(...this._chainListMap.deleteNodesBelongToAChain(chainKey, nodeKeys));
281
281
  chainKeysToReconstuct.push(chainKey);
282
282
  });
283
- this._reconstructChains(chainKeysToReconstuct);
284
283
  this._textContextWriterInjectionMap.forEach((writer) => writer.deleteTextBulk(bufferKeys));
285
284
  // if (textWriterIDs) this._updateTexts(chainKeysToReconstuct, textWriterIDs)
286
285
  this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
286
+ this._reconstructChains(chainKeysToReconstuct);
287
+ this._updateTexts(chainKeysToReconstuct, textWriterIDs);
287
288
  this.globe.DrawRender();
288
289
 
289
290
  }
@@ -294,7 +295,6 @@ export class CircleLineChainPlugin {
294
295
  _updateTexts(chainKeys, textWriterIDs) {
295
296
  const textWriters = textWriterIDs.map((v) => this._textContextWriterInjectionMap.get(v));
296
297
  chainKeys.forEach((chainKey) => {
297
- console.log("textUpdate");
298
298
  this._chainListMap.textUpdate(chainKey, textWriters);
299
299
  })
300
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -104,21 +104,7 @@ export class ContextTextWriter2 {
104
104
  })
105
105
  }
106
106
 
107
- updateTextCoords(item, i, container, properties) {
108
- const coords = this.coordinatesAdaptor(item, i, container, properties);
109
- if (coords == null) return;
110
- const key = this.keyAdaptor(item, i, container, properties);
111
- const data = this.itemMap.get(key)
112
- data.angle = this.angleAdaptor(item, i, container, properties);
113
- data.long = coords.long;
114
- data.lat = coords.lat;
115
- }
116
107
 
117
- updateTextCoordsBulk(container, properties) {
118
- container.forEach((v, i, c) => {
119
- this.updateTextCoords(v, i, c, properties)
120
- })
121
- }
122
108
 
123
109
  deleteTextBulk(keys) {
124
110
  for (const key of keys) {