Layout add minWidth minHeight maxWidth maxHeight

This commit is contained in:
pengfei.zhou
2020-04-11 12:20:43 +08:00
committed by osborn
parent 4e537eed47
commit 80811a3bf6
15 changed files with 228 additions and 112 deletions

View File

@@ -43,6 +43,12 @@ export interface LayoutConfig {
alignment?: Gravity
//Only affective in VLayout or HLayout
weight?: number
maxWidth?: number
maxHeight?: number
minWidth?: number
minHeight?: number
}
export class LayoutConfigImpl implements LayoutConfig, Modeling {
@@ -58,6 +64,12 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
//Only affective in VLayout or HLayout
weight?: number
maxWidth?: number
maxHeight?: number
minWidth?: number
minHeight?: number
fit() {
this.widthSpec = LayoutSpec.FIT
this.heightSpec = LayoutSpec.FIT
@@ -106,6 +118,26 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
return this
}
configMaxWidth(v: number) {
this.maxWidth = v
return this
}
configMaxHeight(v: number) {
this.maxHeight = v
return this
}
configMinWidth(v: number) {
this.minWidth = v
return this
}
configMinHeight(v: number) {
this.minHeight = v
return this
}
toModel() {
return {
widthSpec: this.widthSpec,