Makes flexNode optional in addWidget
This commit is contained in:
parent
e2a4046a34
commit
fcb2bdccee
@ -1,8 +1,10 @@
|
||||
import { Component } from "../../core/Component";
|
||||
import { NodeWidget } from "../../QtGui/QWidget";
|
||||
|
||||
// All Layouts should extend this abstract class.
|
||||
export abstract class NodeLayout extends Component {
|
||||
type: string = "layout";
|
||||
abstract addWidget: (childWidget: NodeWidget, ...args: any[]) => void;
|
||||
}
|
||||
|
||||
// export class QLayout extends NodeLayout { //Dont need QLayout for now
|
||||
|
||||
@ -8,9 +8,10 @@ export class FlexLayout extends NodeLayout {
|
||||
native: NativeElement = new addon.FlexLayout();
|
||||
protected flexNode?: FlexNode;
|
||||
|
||||
addWidget = (childWidget: NodeWidget, childFlexNode: FlexNode) => {
|
||||
addWidget = (childWidget: NodeWidget, childFlexNode?: FlexNode) => {
|
||||
const childYogaNode = childFlexNode || childWidget.getFlexNode();
|
||||
this.children.add(childWidget);
|
||||
this.native.addWidget(childWidget.native, childFlexNode);
|
||||
this.native.addWidget(childWidget.native, childYogaNode);
|
||||
};
|
||||
setFlexNode = (flexNode: FlexNode) => {
|
||||
this.flexNode = flexNode;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user