@woosh/meep-engine 2.131.1 → 2.131.3
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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.131.
|
|
8
|
+
"version": "2.131.3",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH;IAgCI;;;OAGG;IACH,uBAFW,MAAM,EAUhB;
|
|
1
|
+
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH;IAgCI;;;OAGG;IACH,uBAFW,MAAM,EAUhB;IA4FD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED;;;;OAIG;IACH,SAFa,IAAI,CAiBhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAalB;IA6BD;;;;OAIG;IACH,UAHW,CAAC,GACC,OAAO,CAqBnB;IA4BD;;;;OAIG;IACH,OAHW,CAAC,GACC,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,CAAC,QAOX;IAED;;;OAGG;IACH,eAFa,CAAC,GAAC,SAAS,CAQvB;IAED;;;OAGG;IACH,YAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;;OAIG;IACH,WAHW,CAAC,GACC,IAAI,CAOhB;IAED;;;OAGG;IACH,cAFa,CAAC,CASb;IAGD;;;OAGG;IACH,WAFa,CAAC,GAAC,SAAS,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAmBvB;IAED;;;;;OAKG;IACH,iBAJW,CAAC,EAAE,kBACH,MAAM,GACJ,CAAC,EAAE,CAUf;IAoBL;;OAEG;IACH,gBAAoB;IACpB;;OAEG;IACH,uBAAoB;IACpB;;OAEG;IACH,eAAmB;IAEnB;;OAEG;IACH,iBA1GiB,IAAI,CA0GF;IAlCf;;;OAGG;IACH,qBAFa,UAAU,CAAC,EAAC,IAAI,CAAC,CAS7B;;CACJ"}
|
|
@@ -109,7 +109,12 @@ export class Deque {
|
|
|
109
109
|
*/
|
|
110
110
|
#circular_previous_position(current) {
|
|
111
111
|
const prev = current - 1;
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
const length = this.#data.length;
|
|
114
|
+
|
|
115
|
+
const last_index = length - 1;
|
|
116
|
+
|
|
117
|
+
return (prev < 0) ? last_index : prev;
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
#check_and_expand() {
|
|
@@ -242,7 +247,16 @@ export class Deque {
|
|
|
242
247
|
return false;
|
|
243
248
|
}
|
|
244
249
|
|
|
245
|
-
this.#
|
|
250
|
+
if(i === this.#head){
|
|
251
|
+
// special case
|
|
252
|
+
this.removeFirst();
|
|
253
|
+
} else if(i === this.#circular_previous_position(this.#tail)){
|
|
254
|
+
// special case
|
|
255
|
+
this.removeLast();
|
|
256
|
+
}else {
|
|
257
|
+
// somewhere in the middle, slower option
|
|
258
|
+
this.#remove_internal_shift_backward(i);
|
|
259
|
+
}
|
|
246
260
|
|
|
247
261
|
return true;
|
|
248
262
|
}
|
|
@@ -250,7 +264,7 @@ export class Deque {
|
|
|
250
264
|
/**
|
|
251
265
|
*
|
|
252
266
|
* @param {T} e
|
|
253
|
-
* @returns {number}
|
|
267
|
+
* @returns {number} absolute index of the element in the backing array, or -1 if not found
|
|
254
268
|
* @private
|
|
255
269
|
*/
|
|
256
270
|
#index_of(e) {
|
|
@@ -266,7 +280,7 @@ export class Deque {
|
|
|
266
280
|
const el = data[index];
|
|
267
281
|
|
|
268
282
|
if (el === e) {
|
|
269
|
-
return
|
|
283
|
+
return index;
|
|
270
284
|
}
|
|
271
285
|
}
|
|
272
286
|
|