Layout add minWidth minHeight maxWidth maxHeight
This commit is contained in:
parent
4e537eed47
commit
80811a3bf6
@ -16,7 +16,6 @@
|
|||||||
package pub.doric.shader;
|
package pub.doric.shader;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.github.pengfeizhou.jscore.JSONBuilder;
|
import com.github.pengfeizhou.jscore.JSONBuilder;
|
||||||
import com.github.pengfeizhou.jscore.JSObject;
|
import com.github.pengfeizhou.jscore.JSObject;
|
||||||
|
@ -92,54 +92,7 @@ public abstract class SuperNode<V extends View> extends ViewNode<V> {
|
|||||||
protected abstract void blendSubNode(JSObject subProperties);
|
protected abstract void blendSubNode(JSObject subProperties);
|
||||||
|
|
||||||
protected void blendSubLayoutConfig(ViewNode viewNode, JSObject jsObject) {
|
protected void blendSubLayoutConfig(ViewNode viewNode, JSObject jsObject) {
|
||||||
JSValue margin = jsObject.getProperty("margin");
|
viewNode.blendLayoutConfig(jsObject);
|
||||||
JSValue widthSpec = jsObject.getProperty("widthSpec");
|
|
||||||
JSValue heightSpec = jsObject.getProperty("heightSpec");
|
|
||||||
ViewGroup.LayoutParams layoutParams = viewNode.getLayoutParams();
|
|
||||||
if (widthSpec.isNumber()) {
|
|
||||||
switch (widthSpec.asNumber().toInt()) {
|
|
||||||
case 1:
|
|
||||||
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
layoutParams.width = Math.max(0, layoutParams.width);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (heightSpec.isNumber()) {
|
|
||||||
switch (heightSpec.asNumber().toInt()) {
|
|
||||||
case 1:
|
|
||||||
layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
layoutParams.height = Math.max(0, layoutParams.height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (margin.isObject() && layoutParams instanceof ViewGroup.MarginLayoutParams) {
|
|
||||||
JSValue topVal = margin.asObject().getProperty("top");
|
|
||||||
if (topVal.isNumber()) {
|
|
||||||
((ViewGroup.MarginLayoutParams) layoutParams).topMargin = DoricUtils.dp2px(topVal.asNumber().toFloat());
|
|
||||||
}
|
|
||||||
JSValue leftVal = margin.asObject().getProperty("left");
|
|
||||||
if (leftVal.isNumber()) {
|
|
||||||
((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = DoricUtils.dp2px(leftVal.asNumber().toFloat());
|
|
||||||
}
|
|
||||||
JSValue rightVal = margin.asObject().getProperty("right");
|
|
||||||
if (rightVal.isNumber()) {
|
|
||||||
((ViewGroup.MarginLayoutParams) layoutParams).rightMargin = DoricUtils.dp2px(rightVal.asNumber().toFloat());
|
|
||||||
}
|
|
||||||
JSValue bottomVal = margin.asObject().getProperty("bottom");
|
|
||||||
if (bottomVal.isNumber()) {
|
|
||||||
((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin = DoricUtils.dp2px(bottomVal.asNumber().toFloat());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mixin(JSObject src, JSObject target) {
|
private void mixin(JSObject src, JSObject target) {
|
||||||
|
@ -37,8 +37,6 @@ import android.widget.LinearLayout;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||||
|
|
||||||
import com.facebook.yoga.YogaNode;
|
|
||||||
import com.facebook.yoga.android.YogaLayout;
|
|
||||||
import com.github.pengfeizhou.jscore.JSArray;
|
import com.github.pengfeizhou.jscore.JSArray;
|
||||||
import com.github.pengfeizhou.jscore.JSDecoder;
|
import com.github.pengfeizhou.jscore.JSDecoder;
|
||||||
import com.github.pengfeizhou.jscore.JSONBuilder;
|
import com.github.pengfeizhou.jscore.JSONBuilder;
|
||||||
@ -55,7 +53,6 @@ import pub.doric.DoricRegistry;
|
|||||||
import pub.doric.async.AsyncResult;
|
import pub.doric.async.AsyncResult;
|
||||||
import pub.doric.extension.bridge.DoricMethod;
|
import pub.doric.extension.bridge.DoricMethod;
|
||||||
import pub.doric.extension.bridge.DoricPromise;
|
import pub.doric.extension.bridge.DoricPromise;
|
||||||
import pub.doric.shader.flex.FlexNode;
|
|
||||||
import pub.doric.utils.DoricConstant;
|
import pub.doric.utils.DoricConstant;
|
||||||
import pub.doric.utils.DoricContextHolder;
|
import pub.doric.utils.DoricContextHolder;
|
||||||
import pub.doric.utils.DoricLog;
|
import pub.doric.utils.DoricLog;
|
||||||
@ -531,7 +528,7 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void blendLayoutConfig(JSObject jsObject) {
|
protected void blendLayoutConfig(JSObject jsObject) {
|
||||||
JSValue margin = jsObject.getProperty("margin");
|
JSValue margin = jsObject.getProperty("margin");
|
||||||
JSValue widthSpec = jsObject.getProperty("widthSpec");
|
JSValue widthSpec = jsObject.getProperty("widthSpec");
|
||||||
JSValue heightSpec = jsObject.getProperty("heightSpec");
|
JSValue heightSpec = jsObject.getProperty("heightSpec");
|
||||||
@ -584,6 +581,14 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
if (jsValue.isNumber() && layoutParams instanceof FrameLayout.LayoutParams) {
|
if (jsValue.isNumber() && layoutParams instanceof FrameLayout.LayoutParams) {
|
||||||
((FrameLayout.LayoutParams) layoutParams).gravity = jsValue.asNumber().toInt();
|
((FrameLayout.LayoutParams) layoutParams).gravity = jsValue.asNumber().toInt();
|
||||||
}
|
}
|
||||||
|
JSValue minWidthValue = jsObject.getProperty("minWidth");
|
||||||
|
if (minWidthValue.isNumber()) {
|
||||||
|
mView.setMinimumWidth(DoricUtils.dp2px(minWidthValue.asNumber().toFloat()));
|
||||||
|
}
|
||||||
|
JSValue minHeightValue = jsObject.getProperty("minHeight");
|
||||||
|
if (minHeightValue.isNumber()) {
|
||||||
|
mView.setMinimumHeight(DoricUtils.dp2px(minHeightValue.asNumber().toFloat()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isAnimating() {
|
protected boolean isAnimating() {
|
||||||
|
@ -15,7 +15,7 @@ class LayoutDemo extends Panel {
|
|||||||
{
|
{
|
||||||
backgroundColor: colors[1],
|
backgroundColor: colors[1],
|
||||||
flexConfig: {
|
flexConfig: {
|
||||||
width: 300,
|
width: 500,
|
||||||
height: 100,
|
height: 100,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -27,71 +27,77 @@ class LayoutDemo extends Panel {
|
|||||||
height: 100,
|
height: 100,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
stack([],
|
// stack([],
|
||||||
{
|
// {
|
||||||
backgroundColor: colors[3],
|
// backgroundColor: colors[3],
|
||||||
flexConfig: {
|
// flexConfig: {
|
||||||
width: 100,
|
// width: 500,
|
||||||
height: 100,
|
// height: 300,
|
||||||
}
|
// }
|
||||||
}),
|
// }),
|
||||||
|
// stack([],
|
||||||
|
// {
|
||||||
|
// backgroundColor: colors[4],
|
||||||
|
// flexConfig: {
|
||||||
|
// width: 500,
|
||||||
|
// height: 500,
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
flexConfig: {
|
flexConfig: {
|
||||||
flexDirection: FlexDirection.COLUMN,
|
flexDirection: FlexDirection.COLUMN,
|
||||||
},
|
},
|
||||||
backgroundColor: colors[4]
|
backgroundColor: colors[4].alpha(0.1)
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
layoutConfig: {
|
layoutConfig: {
|
||||||
widthSpec: LayoutSpec.FIT,
|
widthSpec: LayoutSpec.FIT,
|
||||||
heightSpec: LayoutSpec.FIT
|
heightSpec: LayoutSpec.FIT,
|
||||||
|
minHeight: 300,
|
||||||
|
maxHeight: 300,
|
||||||
},
|
},
|
||||||
backgroundColor: colors[0],
|
backgroundColor: colors[0].alpha(0.3),
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
layoutConfig: layoutConfig().just(),
|
layoutConfig: layoutConfig().fit(),
|
||||||
width: 250,
|
|
||||||
height: 250,
|
|
||||||
}
|
}
|
||||||
)
|
).in(root)
|
||||||
//.in(root)
|
// flexScroller(
|
||||||
flexScroller(
|
// [
|
||||||
[
|
// stack([],
|
||||||
stack([],
|
// {
|
||||||
{
|
// backgroundColor: colors[1],
|
||||||
backgroundColor: colors[1],
|
// flexConfig: {
|
||||||
flexConfig: {
|
// width: 500,
|
||||||
width: 500,
|
// height: 100,
|
||||||
height: 100,
|
// }
|
||||||
}
|
// }),
|
||||||
}),
|
// stack([],
|
||||||
stack([],
|
// {
|
||||||
{
|
// backgroundColor: colors[2],
|
||||||
backgroundColor: colors[2],
|
// flexConfig: {
|
||||||
flexConfig: {
|
// width: 100,
|
||||||
width: 100,
|
// height: 300,
|
||||||
height: 100,
|
// }
|
||||||
}
|
// }),
|
||||||
}),
|
// stack([],
|
||||||
stack([],
|
// {
|
||||||
{
|
// backgroundColor: colors[3],
|
||||||
backgroundColor: colors[3],
|
// flexConfig: {
|
||||||
flexConfig: {
|
// width: 100,
|
||||||
width: 100,
|
// height: 100,
|
||||||
height: 100,
|
// }
|
||||||
}
|
// }),
|
||||||
}),
|
// ],
|
||||||
],
|
// {
|
||||||
{
|
// backgroundColor: Color.GRAY.alpha(0.3),
|
||||||
backgroundColor: Color.GRAY.alpha(0.3),
|
// layoutConfig: layoutConfig().fit(),
|
||||||
layoutConfig: layoutConfig().just(),
|
// flexConfig: {
|
||||||
width: 300,
|
// maxWidth: 300,
|
||||||
height: 300,
|
// maxHeight: 300,
|
||||||
flexConfig: {
|
// },
|
||||||
overFlow: OverFlow.HIDDEN,
|
// })//.in(root)
|
||||||
}
|
|
||||||
}).in(root)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -104,6 +104,15 @@ - (void)measure:(CGSize)targetSize {
|
|||||||
width - self.paddingLeft - self.paddingRight,
|
width - self.paddingLeft - self.paddingRight,
|
||||||
height - self.paddingTop - self.paddingBottom)];
|
height - self.paddingTop - self.paddingBottom)];
|
||||||
|
|
||||||
|
if ([self restrainSize]) {
|
||||||
|
[self measureContent:CGSizeMake(
|
||||||
|
self.measuredWidth - self.paddingLeft - self.paddingRight,
|
||||||
|
self.measuredHeight - self.paddingTop - self.paddingBottom)];
|
||||||
|
}
|
||||||
|
[self restrainSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)restrainSize {
|
||||||
BOOL needRemeasure = NO;
|
BOOL needRemeasure = NO;
|
||||||
if (self.measuredWidth > self.maxWidth) {
|
if (self.measuredWidth > self.maxWidth) {
|
||||||
self.measuredWidth = self.maxWidth;
|
self.measuredWidth = self.maxWidth;
|
||||||
@ -121,11 +130,7 @@ - (void)measure:(CGSize)targetSize {
|
|||||||
self.measuredHeight = self.minHeight;
|
self.measuredHeight = self.minHeight;
|
||||||
needRemeasure = YES;
|
needRemeasure = YES;
|
||||||
}
|
}
|
||||||
if (needRemeasure) {
|
return needRemeasure;
|
||||||
[self measureContent:CGSizeMake(
|
|
||||||
self.measuredWidth - self.paddingLeft - self.paddingRight,
|
|
||||||
self.measuredHeight - self.paddingTop - self.paddingBottom)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)measureContent:(CGSize)targetSize {
|
- (void)measureContent:(CGSize)targetSize {
|
||||||
|
@ -430,6 +430,18 @@ - (void)blendLayoutConfig:(NSDictionary *)params {
|
|||||||
[params[@"weight"] also:^(NSNumber *it) {
|
[params[@"weight"] also:^(NSNumber *it) {
|
||||||
self.view.doricLayout.weight = (DoricGravity) [it integerValue];
|
self.view.doricLayout.weight = (DoricGravity) [it integerValue];
|
||||||
}];
|
}];
|
||||||
|
[params[@"maxWidth"] also:^(NSNumber *it) {
|
||||||
|
self.view.doricLayout.maxWidth = (DoricGravity) [it integerValue];
|
||||||
|
}];
|
||||||
|
[params[@"maxHeight"] also:^(NSNumber *it) {
|
||||||
|
self.view.doricLayout.maxHeight = (DoricGravity) [it integerValue];
|
||||||
|
}];
|
||||||
|
[params[@"minWidth"] also:^(NSNumber *it) {
|
||||||
|
self.view.doricLayout.minWidth = (DoricGravity) [it integerValue];
|
||||||
|
}];
|
||||||
|
[params[@"minHeight"] also:^(NSNumber *it) {
|
||||||
|
self.view.doricLayout.minHeight = (DoricGravity) [it integerValue];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *)transformation {
|
- (NSDictionary *)transformation {
|
||||||
|
@ -705,6 +705,22 @@ var LayoutConfigImpl = /** @class */ (function () {
|
|||||||
this.weight = w;
|
this.weight = w;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
LayoutConfigImpl.prototype.configMaxWidth = function (v) {
|
||||||
|
this.maxWidth = v;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.configMaxHeight = function (v) {
|
||||||
|
this.maxHeight = v;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.configMinWidth = function (v) {
|
||||||
|
this.minWidth = v;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.configMinHeight = function (v) {
|
||||||
|
this.minHeight = v;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
LayoutConfigImpl.prototype.toModel = function () {
|
LayoutConfigImpl.prototype.toModel = function () {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
@ -570,6 +570,22 @@ class LayoutConfigImpl {
|
|||||||
this.weight = w;
|
this.weight = w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
configMaxWidth(v) {
|
||||||
|
this.maxWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMaxHeight(v) {
|
||||||
|
this.maxHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinWidth(v) {
|
||||||
|
this.minWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinHeight(v) {
|
||||||
|
this.minHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
toModel() {
|
toModel() {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
@ -2029,6 +2029,22 @@ class LayoutConfigImpl {
|
|||||||
this.weight = w;
|
this.weight = w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
configMaxWidth(v) {
|
||||||
|
this.maxWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMaxHeight(v) {
|
||||||
|
this.maxHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinWidth(v) {
|
||||||
|
this.minWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinHeight(v) {
|
||||||
|
this.minHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
toModel() {
|
toModel() {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
12
doric-js/index.d.ts
vendored
12
doric-js/index.d.ts
vendored
@ -1197,6 +1197,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
|
|||||||
};
|
};
|
||||||
alignment?: Gravity;
|
alignment?: Gravity;
|
||||||
weight?: number;
|
weight?: number;
|
||||||
|
maxWidth?: number;
|
||||||
|
maxHeight?: number;
|
||||||
|
minWidth?: number;
|
||||||
|
minHeight?: number;
|
||||||
}
|
}
|
||||||
export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
||||||
widthSpec?: LayoutSpec;
|
widthSpec?: LayoutSpec;
|
||||||
@ -1209,6 +1213,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
|
|||||||
};
|
};
|
||||||
alignment?: Gravity;
|
alignment?: Gravity;
|
||||||
weight?: number;
|
weight?: number;
|
||||||
|
maxWidth?: number;
|
||||||
|
maxHeight?: number;
|
||||||
|
minWidth?: number;
|
||||||
|
minHeight?: number;
|
||||||
fit(): this;
|
fit(): this;
|
||||||
most(): this;
|
most(): this;
|
||||||
just(): this;
|
just(): this;
|
||||||
@ -1222,6 +1230,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
|
|||||||
}): this;
|
}): this;
|
||||||
configAlignment(a: Gravity): this;
|
configAlignment(a: Gravity): this;
|
||||||
configWeight(w: number): this;
|
configWeight(w: number): this;
|
||||||
|
configMaxWidth(v: number): this;
|
||||||
|
configMaxHeight(v: number): this;
|
||||||
|
configMinWidth(v: number): this;
|
||||||
|
configMinHeight(v: number): this;
|
||||||
toModel(): {
|
toModel(): {
|
||||||
widthSpec: LayoutSpec | undefined;
|
widthSpec: LayoutSpec | undefined;
|
||||||
heightSpec: LayoutSpec | undefined;
|
heightSpec: LayoutSpec | undefined;
|
||||||
|
12
doric-js/lib/src/util/layoutconfig.d.ts
vendored
12
doric-js/lib/src/util/layoutconfig.d.ts
vendored
@ -25,6 +25,10 @@ export interface LayoutConfig {
|
|||||||
};
|
};
|
||||||
alignment?: Gravity;
|
alignment?: Gravity;
|
||||||
weight?: number;
|
weight?: number;
|
||||||
|
maxWidth?: number;
|
||||||
|
maxHeight?: number;
|
||||||
|
minWidth?: number;
|
||||||
|
minHeight?: number;
|
||||||
}
|
}
|
||||||
export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
|
export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
|
||||||
widthSpec?: LayoutSpec;
|
widthSpec?: LayoutSpec;
|
||||||
@ -37,6 +41,10 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
};
|
};
|
||||||
alignment?: Gravity;
|
alignment?: Gravity;
|
||||||
weight?: number;
|
weight?: number;
|
||||||
|
maxWidth?: number;
|
||||||
|
maxHeight?: number;
|
||||||
|
minWidth?: number;
|
||||||
|
minHeight?: number;
|
||||||
fit(): this;
|
fit(): this;
|
||||||
most(): this;
|
most(): this;
|
||||||
just(): this;
|
just(): this;
|
||||||
@ -50,6 +58,10 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
}): this;
|
}): this;
|
||||||
configAlignment(a: Gravity): this;
|
configAlignment(a: Gravity): this;
|
||||||
configWeight(w: number): this;
|
configWeight(w: number): this;
|
||||||
|
configMaxWidth(v: number): this;
|
||||||
|
configMaxHeight(v: number): this;
|
||||||
|
configMinWidth(v: number): this;
|
||||||
|
configMinHeight(v: number): this;
|
||||||
toModel(): {
|
toModel(): {
|
||||||
widthSpec: LayoutSpec | undefined;
|
widthSpec: LayoutSpec | undefined;
|
||||||
heightSpec: LayoutSpec | undefined;
|
heightSpec: LayoutSpec | undefined;
|
||||||
|
@ -49,6 +49,22 @@ export class LayoutConfigImpl {
|
|||||||
this.weight = w;
|
this.weight = w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
configMaxWidth(v) {
|
||||||
|
this.maxWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMaxHeight(v) {
|
||||||
|
this.maxHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinWidth(v) {
|
||||||
|
this.minWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinHeight(v) {
|
||||||
|
this.minHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
toModel() {
|
toModel() {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
@ -43,6 +43,12 @@ export interface LayoutConfig {
|
|||||||
alignment?: Gravity
|
alignment?: Gravity
|
||||||
//Only affective in VLayout or HLayout
|
//Only affective in VLayout or HLayout
|
||||||
weight?: number
|
weight?: number
|
||||||
|
|
||||||
|
maxWidth?: number
|
||||||
|
maxHeight?: number
|
||||||
|
|
||||||
|
minWidth?: number
|
||||||
|
minHeight?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
||||||
@ -58,6 +64,12 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
//Only affective in VLayout or HLayout
|
//Only affective in VLayout or HLayout
|
||||||
weight?: number
|
weight?: number
|
||||||
|
|
||||||
|
maxWidth?: number
|
||||||
|
maxHeight?: number
|
||||||
|
|
||||||
|
minWidth?: number
|
||||||
|
minHeight?: number
|
||||||
|
|
||||||
fit() {
|
fit() {
|
||||||
this.widthSpec = LayoutSpec.FIT
|
this.widthSpec = LayoutSpec.FIT
|
||||||
this.heightSpec = LayoutSpec.FIT
|
this.heightSpec = LayoutSpec.FIT
|
||||||
@ -106,6 +118,26 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
return this
|
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() {
|
toModel() {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
16
doric-web/dist/index.js
vendored
16
doric-web/dist/index.js
vendored
@ -2087,6 +2087,22 @@ class LayoutConfigImpl {
|
|||||||
this.weight = w;
|
this.weight = w;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
configMaxWidth(v) {
|
||||||
|
this.maxWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMaxHeight(v) {
|
||||||
|
this.maxHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinWidth(v) {
|
||||||
|
this.minWidth = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
configMinHeight(v) {
|
||||||
|
this.minHeight = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
toModel() {
|
toModel() {
|
||||||
return {
|
return {
|
||||||
widthSpec: this.widthSpec,
|
widthSpec: this.widthSpec,
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user