MCPcopy Create free account
hub / github.com/galacean/engine / deleteByIndex

Method deleteByIndex

packages/core/src/utils/DisorderedArray.ts:83–100  ·  view source on GitHub ↗

* Delete the element at the specified index. * @param index - The index of the element to be deleted * @returns The replaced item is used to reset its index

(index: number)

Source from the content-addressed store, hash-verified

81 * @returns The replaced item is used to reset its index
82 */
83 deleteByIndex(index: number): T {
84 const elements = this._elements;
85 let end: T;
86 if (this._loopCounter > 0) {
87 this._elements[index] = null;
88 this._blankCount++;
89 } else {
90 const endIndex = this.length - 1;
91 if (index !== endIndex) {
92 end = elements[endIndex];
93 elements[index] = end;
94 }
95 elements[endIndex] = null;
96 this.length--;
97 }
98
99 return end;
100 }
101
102 /**
103 * Loop through all elements.

Callers 15

deleteMethod · 0.95
_removeColliderShapeMethod · 0.80
_fireEventMethod · 0.80
removeCameraMethod · 0.80
removeRendererMethod · 0.80
removeUICanvasMethod · 0.80
removeOnStartScriptMethod · 0.80
removeOnUpdateScriptMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected