mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
fix add CanvasComponent undo bug (#4260)
This commit is contained in:
@@ -185,7 +185,7 @@ export class UI {
|
||||
}
|
||||
}
|
||||
|
||||
public addScreen (comp) {
|
||||
public addScreen (comp: CanvasComponent) {
|
||||
this._screens.push(comp);
|
||||
if (comp.camera) {
|
||||
comp.camera.view.visibility = this._screens.length;
|
||||
@@ -204,12 +204,14 @@ export class UI {
|
||||
return null;
|
||||
}
|
||||
|
||||
public removeScreen (comp) {
|
||||
public removeScreen (comp: CanvasComponent) {
|
||||
const idx = this._screens.indexOf(comp);
|
||||
if (idx !== -1) {
|
||||
this._screens.splice(idx, 1);
|
||||
if (idx === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._screens.splice(idx, 1);
|
||||
|
||||
let camera: Camera | null;
|
||||
for (let i = idx; i < this._screens.length;) {
|
||||
camera = this._screens[i].camera;
|
||||
|
||||
@@ -154,4 +154,4 @@ export function baseNodePolyfill (BaseNode) {
|
||||
return this.name + ', path: ' + path;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user