Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spine-ts/spine-core/src/SkeletonBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export class SkeletonBinary {
}

private readFloatArray (input: BinaryInput, n: number, scale: number): number[] {
let array = new Array<number>(n);
let array = [];
if (scale == 1) {
for (let i = 0; i < n; i++)
array[i] = input.readFloat();
Expand All @@ -664,7 +664,7 @@ export class SkeletonBinary {
}

private readShortArray (input: BinaryInput, n: number): number[] {
let array = new Array<number>(n);
let array = [];
for (let i = 0; i < n; i++)
array[i] = input.readInt(true);
return array;
Expand Down
10 changes: 5 additions & 5 deletions spine-ts/spine-core/src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class Utils {
}

static newArray<T> (size: number, defaultValue: T): Array<T> {
let array = new Array<T>(size);
let array = new Array<T>();
for (let i = 0; i < size; i++) array[i] = defaultValue;
return array;
}
Expand All @@ -305,8 +305,8 @@ export class Utils {
if (Utils.SUPPORTS_TYPED_ARRAYS)
return new Float32Array(size)
else {
let array = new Array<number>(size);
for (let i = 0; i < array.length; i++) array[i] = 0;
let array = new Array<number>();
for (let i = 0; i < size; i++) array[i] = 0;
return array;
}
}
Expand All @@ -315,8 +315,8 @@ export class Utils {
if (Utils.SUPPORTS_TYPED_ARRAYS)
return new Int16Array(size)
else {
let array = new Array<number>(size);
for (let i = 0; i < array.length; i++) array[i] = 0;
let array = new Array<number>();
for (let i = 0; i < size; i++) array[i] = 0;
return array;
}
}
Expand Down
2 changes: 1 addition & 1 deletion spine-ts/spine-core/src/attachments/Attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export abstract class VertexAttachment extends Attachment {
/** Does not copy id (generated) or name (set on construction). **/
copyTo (attachment: VertexAttachment) {
if (this.bones) {
attachment.bones = new Array<number>(this.bones.length);
attachment.bones = [];
Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
} else
attachment.bones = null;
Expand Down
8 changes: 4 additions & 4 deletions spine-ts/spine-core/src/attachments/MeshAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,19 @@ export class MeshAttachment extends VertexAttachment implements HasTextureRegion
copy.color.setFromColor(this.color);

this.copyTo(copy);
copy.regionUVs = new Array<number>(this.regionUVs.length);
copy.regionUVs = [];
Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
copy.uvs = this.uvs instanceof Float32Array ? Utils.newFloatArray(this.uvs.length) : new Array<number>(this.uvs.length);
copy.uvs = this.uvs instanceof Float32Array ? Utils.newFloatArray(this.uvs.length) : [];
Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
copy.triangles = new Array<number>(this.triangles.length);
copy.triangles = [];
Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
copy.hullLength = this.hullLength;

copy.sequence = this.sequence != null ? this.sequence.copy() : null;

// Nonessential.
if (this.edges) {
copy.edges = new Array<number>(this.edges.length);
copy.edges = [];
Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
}
copy.width = this.width;
Expand Down
2 changes: 1 addition & 1 deletion spine-ts/spine-core/src/attachments/PathAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class PathAttachment extends VertexAttachment {
copy (): Attachment {
let copy = new PathAttachment(this.name);
this.copyTo(copy);
copy.lengths = new Array<number>(this.lengths.length);
copy.lengths = [];
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
copy.closed = closed;
copy.constantSpeed = this.constantSpeed;
Expand Down
2 changes: 1 addition & 1 deletion spine-ts/spine-player/src/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export class SpinePlayer implements Disposable {
let minX = 100000000, maxX = -100000000, minY = 100000000, maxY = -100000000;
let offset = new Vector2(), size = new Vector2();

const tempArray = new Array<number>(2);
const tempArray = [0, 0];
for (let i = 0; i < steps; i++, time += stepTime) {
animation.apply(this.skeleton!, time, time, false, [], 1, MixBlend.setup, MixDirection.in, false);
this.skeleton!.updateWorldTransform(Physics.update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ export class SpineWebComponentSkeleton extends HTMLElement implements Disposable
skeleton.setupPose();

let offset = new Vector2(), size = new Vector2();
const tempArray = new Array<number>(2);
const tempArray = [0, 0];
if (!animation) {
skeleton.updateWorldTransform(Physics.update);
skeleton.getBounds(offset, size, tempArray, renderer.skeletonRenderer.getSkeletonClipping());
Expand Down