@woosh/meep-engine 2.103.0 → 2.105.0

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.
@@ -7,14 +7,21 @@ import { returnZero } from "../function/returnZero.js";
7
7
  import { strictEquals } from "../function/strictEquals.js";
8
8
  import { CacheElement } from "./CacheElement.js";
9
9
 
10
- // TODO validate hashes of held elements to keep them up to date. Keys are assumed to be immutable, but this assumption may be broken by users
11
-
12
10
  /**
13
11
  * Hash-based cache, uses LRU (least-recently-used) eviction policy
12
+ * Make sure that keys being used are truly immutable when it comes to hash and equality calculation, otherwise cache corruption is inevitable
14
13
  * @template Key, Value
15
14
  * @extends Map<Key,Value>
16
15
  */
17
16
  export class Cache {
17
+ #maxWeight = Number.POSITIVE_INFINITY;
18
+ /**
19
+ *
20
+ * @type {number}
21
+ * @private
22
+ */
23
+ #weight = 0;
24
+
18
25
  /**
19
26
  * @param {number} [maxWeight=Number.POSITIVE_INFINITY]
20
27
  * @param {function(key:Key):number} [keyWeigher= key=>0]
@@ -44,14 +51,8 @@ export class Cache {
44
51
  * @type {number}
45
52
  * @private
46
53
  */
47
- this.maxWeight = maxWeight;
54
+ this.#maxWeight = maxWeight;
48
55
 
49
- /**
50
- *
51
- * @type {number}
52
- * @private
53
- */
54
- this.weight = 0;
55
56
 
56
57
  /**
57
58
  *
@@ -152,18 +153,37 @@ export class Cache {
152
153
  return this.data.size;
153
154
  }
154
155
 
156
+ /**
157
+ * @deprecated use {@link maxWeight} directly instead
158
+ */
159
+ setMaxWeight(value) {
160
+ this.maxWeight = value;
161
+ }
162
+
163
+ /**
164
+ * Total weight of all elements currently in the cache
165
+ * @returns {number}
166
+ */
167
+ get weight() {
168
+ return this.#weight;
169
+ }
170
+
155
171
  /**
156
172
  * Will cause evictions if current weight is smaller than what we're setting
157
173
  * @param {number} value
158
174
  */
159
- setMaxWeight(value) {
175
+ set maxWeight(value) {
160
176
  if (typeof value !== "number" || value < 0) {
161
177
  throw new Error(`Weight must be a non-negative number, instead was '${value}'`);
162
178
  }
163
179
 
164
- this.maxWeight = value;
180
+ this.#maxWeight = value;
165
181
 
166
- this.evictUntilWeight(this.maxWeight);
182
+ this.evictUntilWeight(this.#maxWeight);
183
+ }
184
+
185
+ get maxWeight() {
186
+ return this.#maxWeight;
167
187
  }
168
188
 
169
189
  /**
@@ -182,7 +202,8 @@ export class Cache {
182
202
  result += weight;
183
203
  }
184
204
 
185
- this.weight = result;
205
+ this.#weight = result;
206
+ this.evictUntilWeight(this.#maxWeight);
186
207
  }
187
208
 
188
209
  /**
@@ -212,13 +233,13 @@ export class Cache {
212
233
 
213
234
  const delta_weight = new_weight - old_weight;
214
235
 
215
- this.weight += delta_weight;
236
+ this.#weight += delta_weight;
216
237
 
217
238
  if (
218
- this.weight > this.maxWeight
219
- && new_weight <= this.maxWeight //make it less likely to drop entire cache
239
+ this.#weight > this.#maxWeight
240
+ && new_weight <= this.#maxWeight //make it less likely to drop entire cache
220
241
  ) {
221
- this.evictUntilWeight(this.maxWeight);
242
+ this.evictUntilWeight(this.#maxWeight);
222
243
  }
223
244
 
224
245
  return true;
@@ -259,7 +280,9 @@ export class Cache {
259
280
  const victim = this.findEvictionVictim();
260
281
 
261
282
  if (victim !== null) {
262
- this.remove(victim.key);
283
+ const removed_from_hash_table = this.remove(victim.key);
284
+
285
+ assert.ok(removed_from_hash_table, `Failed to remove key '${victim.key}', likely reasons:\n\t1. key was mutated (keys must never be mutated)\n\t2. provided hashing function is unstable\n\t3. provided equality function is inconsistent`);
263
286
 
264
287
  this.onEvicted.send2(victim.key, victim.value);
265
288
 
@@ -280,7 +303,7 @@ export class Cache {
280
303
 
281
304
  const target = Math.max(targetWeight, 0);
282
305
 
283
- while (this.weight > target) {
306
+ while (this.#weight > target) {
284
307
  this.evictOne();
285
308
  }
286
309
  }
@@ -322,7 +345,7 @@ export class Cache {
322
345
  * in which case entire cache will be evicted, but there still won't be enough space
323
346
  * @type {number}
324
347
  */
325
- const weightTarget = this.maxWeight - elementWeight;
348
+ const weightTarget = this.#maxWeight - elementWeight;
326
349
 
327
350
  if (weightTarget < 0) {
328
351
  // Special case
@@ -337,15 +360,15 @@ export class Cache {
337
360
  this.data.set(key, element);
338
361
 
339
362
  //update weight
340
- this.weight += elementWeight;
363
+ this.#weight += elementWeight;
341
364
  } else {
342
365
  // check if value is the same
343
366
  if (value === element.value) {
344
367
  // same value, no action required
345
368
  } else {
346
369
  // replace value, adjust weight
347
- this.weight -= this.valueWeigher(element.value);
348
- this.weight += this.valueWeigher(value);
370
+ this.#weight -= this.valueWeigher(element.value);
371
+ this.#weight += this.valueWeigher(value);
349
372
 
350
373
  element.value = value;
351
374
  }
@@ -431,7 +454,7 @@ export class Cache {
431
454
  this.data.delete(key);
432
455
 
433
456
  //update weight
434
- this.weight -= element.weight;
457
+ this.#weight -= element.weight;
435
458
  }
436
459
 
437
460
  /**
@@ -503,7 +526,7 @@ export class Cache {
503
526
  this.__first = null;
504
527
  this.__last = null;
505
528
 
506
- this.weight = 0;
529
+ this.#weight = 0;
507
530
  }
508
531
 
509
532
  /**
@@ -32,6 +32,19 @@ test("trying to insert an element into the cache that's larger than the cache ca
32
32
  expect(cache.contains(2)).toBe(false);
33
33
  });
34
34
 
35
+ test("Recently accessed element should not be targeted for eviction where possible", () => {
36
+ const cache = new Cache();
37
+
38
+ cache.put(2, "hello");
39
+ cache.put(7, "world");
40
+
41
+ cache.get(2);
42
+
43
+ cache.evictOne();
44
+
45
+ expect(cache.has(2)).toBe(true);
46
+ });
47
+
35
48
  test("removeListener is called when element is evicted", () => {
36
49
 
37
50
  const removeListener = jest.fn();
@@ -233,3 +246,32 @@ test("silentRemove should not notify", () => {
233
246
 
234
247
  expect(mock).not.toHaveBeenCalled();
235
248
  });
249
+
250
+ test("setting maxWeight will drop data and update weight", () => {
251
+
252
+ const cache = new Cache();
253
+
254
+ cache.set("a", 1);
255
+ cache.set("b", 2);
256
+ cache.set("c", 3);
257
+
258
+ expect(cache.weight).toEqual(3);
259
+
260
+ cache.maxWeight = 1;
261
+
262
+ expect(cache.maxWeight).toEqual(1);
263
+ expect(cache.weight).toEqual(1);
264
+ });
265
+
266
+ test("setting maxWeight to 0 will empty out cache", () => {
267
+
268
+ const cache = new Cache();
269
+
270
+ cache.set("a", 1);
271
+ cache.set("b", 2);
272
+
273
+ cache.maxWeight = 0;
274
+
275
+ expect(cache.size()).toBe(0);
276
+
277
+ });
@@ -30,5 +30,6 @@ export class CacheElement<Key, Value> {
30
30
  */
31
31
  previous: CacheElement<Key_1, Value_1>;
32
32
  unlink(): void;
33
+ toString(): string;
33
34
  }
34
35
  //# sourceMappingURL=CacheElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CacheElement.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/CacheElement.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;IAMQ;;;OAGG;IACH,WAAe;IAEf;;;OAGG;IACH,eAAiB;IAEjB;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,mCAAgB;IAEhB;;;OAGG;IACH,uCAAoB;IAGxB,eAWC;CACJ"}
1
+ {"version":3,"file":"CacheElement.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/CacheElement.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;IAMQ;;;OAGG;IACH,WAAe;IAEf;;;OAGG;IACH,eAAiB;IAEjB;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,mCAAgB;IAEhB;;;OAGG;IACH,uCAAoB;IAGxB,eAWC;IAED,mBAEC;CACJ"}
@@ -52,4 +52,8 @@ export class CacheElement {
52
52
  next.previous = previous;
53
53
  }
54
54
  }
55
+
56
+ toString() {
57
+ return `CacheElement{ hasNext:${this.next !== null}, hasPrevious:${this.previous !== null}, weight:${this.weight}, key:${this.key}, value:${this.value} }`;
58
+ }
55
59
  }
@@ -9,16 +9,6 @@ declare class LineBuilder {
9
9
  * @returns {LineBuilder}
10
10
  */
11
11
  static fromText(text: string): LineBuilder;
12
- /**
13
- *
14
- * @type {Line[]}
15
- */
16
- lines: Line[];
17
- /**
18
- *
19
- * @type {number}
20
- */
21
- indentation: number;
22
12
  /**
23
13
  *
24
14
  * @type {number}
@@ -62,19 +52,6 @@ declare class LineBuilder {
62
52
  * @returns {string}
63
53
  */
64
54
  build(): string;
65
- }
66
- /**
67
- * Created by Alex on 08/06/2015.
68
- */
69
- declare class Line {
70
- /**
71
- *
72
- * @param {string} text
73
- * @param {number} indent
74
- * @constructor
75
- */
76
- constructor(text: string, indent: number);
77
- text: string;
78
- indentation: number;
55
+ #private;
79
56
  }
80
57
  //# sourceMappingURL=LineBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";AAoBA;;GAEG;AACH;IAkII;;;;OAIG;IACH,sBAHW,MAAM,GACJ,WAAW,CAkBvB;IArJD;;;OAGG;IACH,OAFU,IAAI,EAAE,CAEL;IACX;;;OAGG;IACH,aAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,cAFU,MAAM,CAEqB;IAErC;;;OAGG;IACH,oBAEC;IAED;;;;OAIG;IACH,wBAFW,MAAM,GADL,OAAO,CAiBlB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,WAAW,CASvB;IAED;;;OAGG;IACH,gBAFW,WAAW,QAgBrB;IAED,cAGC;IAED;;;OAGG;IACH,SAFa,MAAM,CAsBlB;CAwBJ;AA/KD;;GAEG;AAGH;IACI;;;;;OAKG;IACH,kBAJW,MAAM,UACN,MAAM,EAMhB;IAFG,aAAgB;IAChB,oBAAyB;CAEhC"}
1
+ {"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";AAoBA;;GAEG;AACH;IAoII;;;;OAIG;IACH,sBAHW,MAAM,GACJ,WAAW,CAoBvB;IA7ID;;;OAGG;IACH,cAFU,MAAM,CAEqB;IAErC;;;OAGG;IACH,oBAEC;IAED;;;;OAIG;IACH,wBAFW,MAAM,GADL,OAAO,CAiBlB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,WAAW,CASvB;IAED;;;OAGG;IACH,gBAFW,WAAW,QAgBrB;IAED,cAGC;IAED;;;OAGG;IACH,SAFa,MAAM,CAsBlB;;CA0BJ"}
@@ -27,12 +27,14 @@ class LineBuilder {
27
27
  *
28
28
  * @type {Line[]}
29
29
  */
30
- lines = [];
30
+ #lines = [];
31
+
31
32
  /**
32
33
  *
33
34
  * @type {number}
34
35
  */
35
- indentation = 0;
36
+ #indentation = 0;
37
+
36
38
  /**
37
39
  *
38
40
  * @type {number}
@@ -44,7 +46,7 @@ class LineBuilder {
44
46
  * @return {number}
45
47
  */
46
48
  get count() {
47
- return this.lines.length;
49
+ return this.#lines.length;
48
50
  }
49
51
 
50
52
  /**
@@ -53,7 +55,7 @@ class LineBuilder {
53
55
  * @param {string} term
54
56
  */
55
57
  containsSubstring(term) {
56
- const lines = this.lines;
58
+ const lines = this.#lines;
57
59
  const n = lines.length;
58
60
  for (let i = 0; i < n; i++) {
59
61
  const line = lines[i];
@@ -73,7 +75,7 @@ class LineBuilder {
73
75
  * @returns {LineBuilder}
74
76
  */
75
77
  indent() {
76
- this.indentation++;
78
+ this.#indentation++;
77
79
  return this;
78
80
  }
79
81
 
@@ -82,7 +84,7 @@ class LineBuilder {
82
84
  * @returns {LineBuilder}
83
85
  */
84
86
  dedent() {
85
- this.indentation--;
87
+ this.#indentation--;
86
88
  return this;
87
89
  }
88
90
 
@@ -93,9 +95,9 @@ class LineBuilder {
93
95
  */
94
96
  add(line_text) {
95
97
 
96
- const line = new Line(line_text, this.indentation);
98
+ const line = new Line(line_text, this.#indentation);
97
99
 
98
- this.lines.push(line);
100
+ this.#lines.push(line);
99
101
 
100
102
  return this;
101
103
  }
@@ -106,23 +108,23 @@ class LineBuilder {
106
108
  */
107
109
  addLines(lines) {
108
110
 
109
- const other_lines = lines.lines;
111
+ const other_lines = lines.#lines;
110
112
 
111
113
  const other_line_count = other_lines.length;
112
114
 
113
115
  for (let i = 0; i < other_line_count; i++) {
114
116
  const otherLine = other_lines[i];
115
117
 
116
- const line = new Line(otherLine.text, otherLine.indentation + this.indentation);
118
+ const line = new Line(otherLine.text, otherLine.indentation + this.#indentation);
117
119
 
118
- this.lines.push(line);
120
+ this.#lines.push(line);
119
121
  }
120
122
 
121
123
  }
122
124
 
123
125
  clear() {
124
- this.lines = [];
125
- this.indentation = 0;
126
+ this.#lines = [];
127
+ this.#indentation = 0;
126
128
  }
127
129
 
128
130
  /**
@@ -134,7 +136,7 @@ class LineBuilder {
134
136
 
135
137
  let i, j, l;
136
138
 
137
- const lines = this.lines;
139
+ const lines = this.#lines;
138
140
 
139
141
  for (i = 0, l = lines.length; i < l; i++) {
140
142
  const line = lines[i];
@@ -167,7 +169,9 @@ class LineBuilder {
167
169
 
168
170
  for (let i = 0; i < n; i++) {
169
171
 
170
- r.add(lines[i]);
172
+ const line_text = lines[i];
173
+
174
+ r.add(line_text);
171
175
 
172
176
  }
173
177
 
@@ -1 +1 @@
1
- {"version":3,"file":"HashMap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/map/HashMap.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;GAYG;AACH,uFAIC;AAsHD;;;;;;;GAOG;AACH;IA2DI;;;;;;OAMG;IACH,4FALuB,MAAM,EAsC5B;IAlBG;;;;;OAKG;IACH,iCAAsC;IACtC;;;;;OAKG;IACH,qCAA8C;IAOlD,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IA2HD;;;;OAIG;IACH,SAHW,CAAC,SACD,CAAC,QAoEX;IAED;;;;OAIG;IACH,SAHW,CAAC,GACC,CAAC,GAAC,SAAS,CA+BvB;IAED;;;;;;;;OAQG;IACH,kBALW,CAAC,kBACQ,CAAC,KAAE,CAAC,0BAEZ,CAAC,CAcZ;IAED;;;;;OAKG;IACH,cAJW,CAAC,SACD,CAAC,GACA,CAAC,CAYZ;IAuBD;;;;OAIG;IACH,YAHW,CAAC,GACC,OAAO,CA+CnB;IAED;;;;;OAKG;IACH,4CAFa,OAAO,CA+BnB;IAOD;;OAEG;IACH,gBAkDC;IAmBD,2CAwBC;IAED;;;;OAIG;IACH,SAHW,CAAC,GACC,OAAO,CAInB;IAED;;OAEG;IACH,cA6BC;IA+BD;;;OAGG;IACH,UAFa,SAAS,CAAC,CAAC,CAOvB;IAED;;;OAGG;IACH,QAFa,SAAS,CAAC,CAAC,CAMvB;IAhDD,yDA2BC;;CAsBJ"}
1
+ {"version":3,"file":"HashMap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/map/HashMap.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;GAYG;AACH,uFAIC;AA8FD;;;;;;;GAOG;AACH;IA+DI;;;;;;OAMG;IACH,4FALuB,MAAM,EAsC5B;IAlBG;;;;;OAKG;IACH,iCAAsC;IACtC;;;;;OAKG;IACH,qCAA8C;IAOlD,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAkJD;;;;OAIG;IACH,SAHW,CAAC,SACD,CAAC,QAsEX;IAED;;;;OAIG;IACH,SAHW,CAAC,GACC,CAAC,GAAC,SAAS,CA+BvB;IAED;;;;;;;;OAQG;IACH,kBALW,CAAC,kBACQ,CAAC,KAAE,CAAC,0BAEZ,CAAC,CAcZ;IAED;;;;;OAKG;IACH,cAJW,CAAC,SACD,CAAC,GACA,CAAC,CAYZ;IAuBD;;;;OAIG;IACH,YAHW,CAAC,GACC,OAAO,CA+CnB;IAED;;;;;OAKG;IACH,4CAFa,OAAO,CA+BnB;IAOD;;OAEG;IACH,gBAkDC;IAmBD,2CAwBC;IAED;;;;OAIG;IACH,SAHW,CAAC,GACC,OAAO,CAInB;IAED;;OAEG;IACH,cA6BC;IA+BD;;;OAGG;IACH,UAFa,SAAS,CAAC,CAAC,CAOvB;IAED;;;OAGG;IACH,QAFa,SAAS,CAAC,CAAC,CAMvB;IAhDD,yDA2BC;;CAsBJ"}
@@ -124,30 +124,6 @@ const RESERVED_HASH_SUBSTITUTE = 0;
124
124
  const UNDEFINED_BIN_INDEX = ~0;
125
125
 
126
126
 
127
- /**
128
- * @template K,V
129
- * @param {HashMapEntry<K,V>} record
130
- * @param {number} hash
131
- * @param {K} key
132
- * @param {function(a:K,b:K):boolean} equality_op
133
- */
134
- function entry_equality_check(record, hash, key, equality_op) {
135
- if (record.hash !== hash) {
136
- return false;
137
- }
138
-
139
- if (record.key === key) {
140
- return true;
141
- }
142
-
143
- const result = equality_op(record.key, key);
144
-
145
- assert.isBoolean(result, `result(a=${record.key},b=${key})`);
146
-
147
- return result;
148
- }
149
-
150
-
151
127
  const EMPTY_BINS = new Uint32Array(0);
152
128
 
153
129
  /**
@@ -215,6 +191,10 @@ export class HashMap {
215
191
  */
216
192
  #load_factor = DEFAULT_LOAD_FACTOR;
217
193
 
194
+ /**
195
+ * Used to track modifications to prevent concurrent changes during iteration
196
+ * @type {number}
197
+ */
218
198
  #version = 0;
219
199
 
220
200
  /**
@@ -339,6 +319,29 @@ export class HashMap {
339
319
  return original === RESERVED_HASH ? RESERVED_HASH_SUBSTITUTE : original;
340
320
  }
341
321
 
322
+ /**
323
+ * @param {HashMapEntry<K,V>} record
324
+ * @param {number} hash
325
+ * @param {K} key
326
+ */
327
+ #entry_equality_check(record, hash, key) {
328
+ if (record.hash !== hash) {
329
+ return false;
330
+ }
331
+
332
+ if (record.key === key) {
333
+ return true;
334
+ }
335
+
336
+ assert.equal(record.hash, this.#build_key_hash(record.key), `Key hash has diverged for key ${record.key}, likely key was mutated or hash function is unstable`);
337
+
338
+ const result = this.keyEqualityFunction(record.key, key);
339
+
340
+ assert.isBoolean(result, `result(a=${record.key},b=${key})`);
341
+
342
+ return result;
343
+ }
344
+
342
345
  /**
343
346
  *
344
347
  * @param {K} k
@@ -402,6 +405,7 @@ export class HashMap {
402
405
 
403
406
  const raw_hash = this.#build_key_hash(key);
404
407
  let bin_index = this.#compute_bin_index(raw_hash);
408
+
405
409
  assert.isFiniteNumber(bin_index, 'hash');
406
410
 
407
411
  let first_deleted_bin_index = UNDEFINED_BIN_INDEX;
@@ -415,11 +419,12 @@ export class HashMap {
415
419
  // check if it's the entry that we're looking for
416
420
  const entry = this.#entries[bin - ENTRY_BASE];
417
421
 
418
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
422
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
419
423
  // found the right entry
420
424
  entry.value = value;
421
425
  return;
422
426
  }
427
+
423
428
  } else if (bin === BIN_RESERVED_VALUE_EMPTY) {
424
429
  // bin is empty
425
430
 
@@ -484,7 +489,7 @@ export class HashMap {
484
489
  // check if the entry is what we're looking for
485
490
  const entry = this.#entries[bin - ENTRY_BASE];
486
491
 
487
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
492
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
488
493
  // found the right entry
489
494
  return entry.value;
490
495
  }
@@ -588,7 +593,7 @@ export class HashMap {
588
593
  const entry_index = bin - ENTRY_BASE;
589
594
  const entry = entries[entry_index];
590
595
 
591
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
596
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
592
597
  // found the right entry
593
598
 
594
599
  // record entry as dead
@@ -244,7 +244,7 @@ export class NodeGraph {
244
244
  * @return {NodeInstance[]}
245
245
  */
246
246
  getNodes() {
247
- return this.nodes.data.slice();
247
+ return this.nodes.asArray().slice();
248
248
  }
249
249
 
250
250
  /**
@@ -252,7 +252,7 @@ export class NodeGraph {
252
252
  * @return {Connection[]}
253
253
  */
254
254
  getConnections() {
255
- return this.connections.data.slice();
255
+ return this.connections.asArray().slice();
256
256
  }
257
257
 
258
258
  /**
@@ -397,7 +397,7 @@ class Mesh {
397
397
  const matrixWorld = skeletonBone.matrixWorld;
398
398
 
399
399
 
400
- result.threejs_setFromMatrixPosition(matrixWorld);
400
+ result.setFromMatrixPosition(matrixWorld.elements);
401
401
  }
402
402
 
403
403
  }
@@ -41,7 +41,7 @@ export class GeometrySpatialQueryAccelerator {
41
41
  * @param {number} value in bytes
42
42
  */
43
43
  set cache_size(value) {
44
- this.cache.setMaxWeight(value);
44
+ this.cache.maxWeight = value;
45
45
  }
46
46
 
47
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PointerDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/PointerDevice.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,wDAFY,OAAO,EAAE,CAapB;AAiRD;;;;;GAKG;AACH,mDAJW,OAAO,SACP,UAAU,WACV,OAAO,QAejB;AAED;;GAEG;AACH;IAqFI;;;;OAIG;IACH,wBAHW,WAAW,EA0CrB;IA/HD;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;IAczB;;OAEG;IACH;;;;QAII;;WAEG;aADO,OAAO,OAAO,EAAE,CAAC,UAAU,GAAC,UAAU,CAAC,CAAC;;;;;;;;MAUpD;IASF;;;OAGG;IACH,kBAAkB;IAElB;;;;OAIG;IACH,kBAFU,iBAAiB,EAAE,CAEL;IAExB;;;OAGG;IACH,yCAEC;IAED;;;OAGG;IACH,0CAEC;IAED;;;OAGG;IACH,2CAEC;IAeG;;;OAGG;IACH,YAFU,WAAW,CAEO;IA6JhC;;;OAGG;IACH,oBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,qBAFW,OAAO,QAwBjB;IAED;;;;OAIG;IACH,qCAHW,OAAO,SACP,UAAU,GAAC,UAAU,QAI/B;IAED,cAkCC;IAED,aA2BC;;CACJ;oBAlrBmB,+BAA+B;mBADhC,uCAAuC;kCAMxB,wBAAwB"}
1
+ {"version":3,"file":"PointerDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/PointerDevice.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,wDAFY,OAAO,EAAE,CAapB;AAiRD;;;;;GAKG;AACH,mDAJW,OAAO,SACP,UAAU,WACV,OAAO,QAejB;AAED;;GAEG;AACH;IA2FI;;;;OAIG;IACH,wBAHW,WAAW,EA0CrB;IArID;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;IAczB;;OAEG;IACH;;;;QAII;;WAEG;aADO,OAAO,OAAO,EAAE,CAAC,UAAU,GAAC,UAAU,CAAC,CAAC;;;;;;;;MAUpD;IAeF;;;OAGG;IACH,kBAAkB;IAElB;;;;OAIG;IACH,kBAFU,iBAAiB,EAAE,CAEL;IAExB;;;OAGG;IACH,yCAEC;IAED;;;OAGG;IACH,0CAEC;IAED;;;OAGG;IACH,2CAEC;IAgLD;;;OAGG;IACH,oBAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,6BAsBC;IAED,0BAEC;IAED;;;;OAIG;IACH,qCAHW,OAAO,SACP,UAAU,GAAC,UAAU,QAI/B;IAED,cAkCC;IAED,aA2BC;;CACJ;oBA5rBmB,+BAA+B;mBADhC,uCAAuC;kCAMxB,wBAAwB"}
@@ -373,6 +373,12 @@ export class PointerDevice {
373
373
  */
374
374
  #target = null;
375
375
 
376
+ /**
377
+ *
378
+ * @type {Element|null}
379
+ */
380
+ #domElement = null;
381
+
376
382
  /**
377
383
  * @private
378
384
  * @type {boolean}
@@ -427,7 +433,7 @@ export class PointerDevice {
427
433
  *
428
434
  * @type {EventTarget}
429
435
  */
430
- this.domElement = domElement;
436
+ this.#domElement = domElement;
431
437
 
432
438
 
433
439
  this.#touchStart.add((param0, param1, param2) => {
@@ -596,11 +602,11 @@ export class PointerDevice {
596
602
  *
597
603
  * @param {Element} el
598
604
  */
599
- setTargetElement(el) {
605
+ set domElement(el) {
600
606
  assert.defined(el, 'el');
601
607
  assert.notNull(el, 'el');
602
608
 
603
- if (this.#target === el) {
609
+ if (this.#domElement === el) {
604
610
  // no change
605
611
  return;
606
612
  }
@@ -612,7 +618,7 @@ export class PointerDevice {
612
618
  this.stop();
613
619
  }
614
620
 
615
- this.#target = el;
621
+ this.#domElement = el;
616
622
 
617
623
  if (was_running) {
618
624
  // restart to maintain original state
@@ -620,6 +626,10 @@ export class PointerDevice {
620
626
  }
621
627
  }
622
628
 
629
+ get domElement() {
630
+ return this.#domElement;
631
+ }
632
+
623
633
  /**
624
634
  *
625
635
  * @param {Vector2} result
@@ -639,7 +649,7 @@ export class PointerDevice {
639
649
 
640
650
  // console.warn("PointerDevice.start");
641
651
 
642
- const domElement = this.domElement;
652
+ const domElement = this.#domElement;
643
653
 
644
654
  assert.notEqual(domElement, null, "domElement is null");
645
655
  assert.notEqual(domElement, undefined, "domElement is undefined");