@galacean/engine-core 1.3.10 → 1.3.11

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "1.3.10"
21
+ "@galacean/engine-math": "1.3.11"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "1.3.10"
24
+ "@galacean/engine-design": "1.3.11"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { Platform } from "./Platform";
2
2
  export { Engine } from "./Engine";
3
3
  export { SystemInfo } from "./SystemInfo";
4
4
  export { Canvas } from "./Canvas";
5
+ export { DisorderedArray } from "./utils/DisorderedArray";
5
6
  export { Scene } from "./Scene";
6
7
  export { SceneManager } from "./SceneManager";
7
8
  export { Entity } from "./Entity";
@@ -0,0 +1,70 @@
1
+ /**
2
+ * High-performance unordered array, delete uses exchange method to improve performance, internal capacity only increases.
3
+ */
4
+ export declare class DisorderedArray<T> {
5
+ /** The length of the array. */
6
+ length: number;
7
+ private _loopCounter;
8
+ private _blankCount;
9
+ /**
10
+ * Get whether the array is in the loop.
11
+ */
12
+ get isLopping(): boolean;
13
+ /**
14
+ * Create a DisorderedArray.
15
+ * @param count - The initial length of the array
16
+ */
17
+ constructor(count?: number);
18
+ /**
19
+ * Add an element to disordered array.
20
+ * @param element - The element to be added
21
+ */
22
+ add(element: T): void;
23
+ /**
24
+ * Delete the specified element.
25
+ * @param element - The element to be deleted
26
+ */
27
+ delete(element: T): void;
28
+ /**
29
+ * Set the element at the specified index.
30
+ * @param index - The index of the element to be set
31
+ * @param element - The element to be set
32
+ */
33
+ set(index: number, element: T): void;
34
+ /**
35
+ * Get the element at the specified index.
36
+ * @param index - The index of the element to be get
37
+ * @returns The element at the specified index
38
+ */
39
+ get(index: number): T;
40
+ /**
41
+ * Delete the element at the specified index.
42
+ * @param index - The index of the element to be deleted
43
+ * @returns The replaced item is used to reset its index
44
+ */
45
+ deleteByIndex(index: number): T;
46
+ /**
47
+ * Loop through all elements.
48
+ * @param callbackFn - The callback function
49
+ * @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
50
+ */
51
+ forEach(callbackFn: (element: T, index: number) => void, swapFn?: (element: T, index: number) => void): void;
52
+ /**
53
+ * Loop through all elements and clean up the blank elements.
54
+ * @param callbackFn - The callback function
55
+ * @param swapFn - The swap function can process the element after the callback function, it will be called after end looping(`isLopping` = true)
56
+ */
57
+ forEachAndClean(callbackFn: (element: T, index: number) => void, swapFn?: (element: T, index: number) => void): void;
58
+ /**
59
+ * Sort the array.
60
+ * @param compareFn - The comparison function
61
+ */
62
+ sort(compareFn: (a: T, b: T) => number): void;
63
+ /**
64
+ * Garbage collection, clean up all cached elements.
65
+ */
66
+ garbageCollection(): void;
67
+ private _startLoop;
68
+ private _endLoop;
69
+ private _endLoopAndClean;
70
+ }
@@ -1,27 +0,0 @@
1
- /**
2
- * High-performance unordered array, delete uses exchange method to improve performance, internal capacity only increases.
3
- */
4
- export declare class DisorderedArray<T> {
5
- length: number;
6
- _elements: T[];
7
- private _isLooping;
8
- private _blankCount;
9
- constructor(count?: number);
10
- add(element: T): void;
11
- delete(element: T): void;
12
- set(index: number, element: T): void;
13
- get(index: number): T;
14
- /**
15
- * Delete the element at the specified index.
16
- * @param index - The index of the element to be deleted
17
- * @returns The replaced item is used to reset its index
18
- */
19
- deleteByIndex(index: number): T;
20
- forEach(callbackFn: (element: T) => void, swapFn: (element: T, index: number) => void): void;
21
- forEachAndClean(callbackFn: (e: T) => void, swapFn: (element: T, index: number) => void): void;
22
- sort(compareFn: (a: T, b: T) => number): void;
23
- garbageCollection(): void;
24
- private _startLoop;
25
- private _endLoop;
26
- private _endLoopAndClean;
27
- }