mirror of
https://github.com/galacean/engine.git
synced 2026-06-05 02:44:47 +08:00
Fix the error when adapting the adaptation editor (#2524)
* fix: the error when adapting the adaptation editor
This commit is contained in:
@@ -283,7 +283,6 @@ export class Sprite extends ReferResource {
|
||||
this._bounds = null;
|
||||
this._atlas = null;
|
||||
this._texture = null;
|
||||
this._updateFlagManager = null;
|
||||
}
|
||||
|
||||
private _calDefaultSize(): void {
|
||||
|
||||
@@ -589,8 +589,8 @@ export class Entity extends EngineObject {
|
||||
}
|
||||
this._parent = null;
|
||||
this._siblingIndex = -1;
|
||||
this._dispatchModify(EntityModifyFlags.Child, oldParent);
|
||||
}
|
||||
this._dispatchModify(EntityModifyFlags.Child, oldParent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -711,6 +711,10 @@ export class Entity extends EngineObject {
|
||||
}
|
||||
}
|
||||
this._setParentChange();
|
||||
} else {
|
||||
if (parent && siblingIndex !== undefined) {
|
||||
this.siblingIndex = siblingIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Entity, Script } from "@galacean/engine-core";
|
||||
import { WebGLEngine } from "@galacean/engine-rhi-webgl";
|
||||
import { vi, describe, beforeEach, expect, it } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
class TestComponent extends Script {}
|
||||
|
||||
@@ -232,6 +232,11 @@ describe("Entity", async () => {
|
||||
parent.addChild(child);
|
||||
expect(child.parent).eq(parent);
|
||||
expect(child.scene).eq(scene);
|
||||
|
||||
const childAno = new Entity(engine, "childAno");
|
||||
childAno.parent = parent;
|
||||
parent.addChild(0, childAno);
|
||||
expect(childAno.siblingIndex).eq(0);
|
||||
});
|
||||
|
||||
it("removeChild", () => {
|
||||
|
||||
Reference in New Issue
Block a user