/
GUICanvas.ts
44 lines (37 loc) · 933 Bytes
/
GUICanvas.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Object3D } from "../../../core/entities/Object3D";
import { ComponentBase } from "../../ComponentBase";
/**
* GUI Root Container
* @group GPU GUI
*/
export class GUICanvas extends ComponentBase {
public readonly isGUICanvas: boolean = true;
public index: number = 0;
/**
*
* Add an Object3D
* @param child Object3D
* @returns
*/
public addChild(child: Object3D): this {
this.object3D.addChild(child);
return this;
}
/**
*
* Remove the child
* @param child Removed Object3D
*/
public removeChild(child: Object3D): this {
this.object3D.removeChild(child);
return this;
}
public cloneTo(obj: Object3D) {
let canvas = obj.getOrAddComponent(GUICanvas);
canvas.copyComponent(this);
}
public copyComponent(from: this): this {
from.index = from.index;
return this;
}
}