mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Fix myview test page in layouts suit
This commit is contained in:
@ -26,6 +26,16 @@ export class ViewModelWithPercentage extends ViewModelBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public onMinWidthMinHeight(args: { eventName: string, object: any }): void {
|
||||||
|
let view = args.object;
|
||||||
|
if (!PercentLength.equals(view.marginLeft, 105)) {
|
||||||
|
super.setMinWidthHeight(view, 105, 55);
|
||||||
|
} else {
|
||||||
|
super.setMinWidthHeight(view, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public onAllProperties(args: { eventName: string, object: any }): void {
|
public onAllProperties(args: { eventName: string, object: any }): void {
|
||||||
let child: any;
|
let child: any;
|
||||||
let layout: any = args.object.parent;
|
let layout: any = args.object.parent;
|
||||||
@ -41,9 +51,9 @@ export class ViewModelWithPercentage extends ViewModelBase {
|
|||||||
// MinWidthMinHeight
|
// MinWidthMinHeight
|
||||||
child = <View>layout.getViewById("minWidthMinHeight");
|
child = <View>layout.getViewById("minWidthMinHeight");
|
||||||
if (child.minWidth !== 105) {
|
if (child.minWidth !== 105) {
|
||||||
super.setWidthHeight(child, 105, 55);
|
super.setMinWidthHeight(child, 105, 55);
|
||||||
} else {
|
} else {
|
||||||
super.setWidthHeight(child, 0, 0);
|
super.setMinWidthHeight(child, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Margins
|
// Margins
|
||||||
|
@ -35,6 +35,11 @@ export class ViewModelBase extends Observable {
|
|||||||
child.height = height;
|
child.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected setMinWidthHeight(child: any, minWidth: any, minHeight: any) {
|
||||||
|
child.minWidth = minWidth;
|
||||||
|
child.minHeight = minHeight;
|
||||||
|
}
|
||||||
|
|
||||||
protected setMargins(child: any, marginLeft: any, marginTop: any, marginRight: any, marginBottom: any) {
|
protected setMargins(child: any, marginLeft: any, marginTop: any, marginRight: any, marginBottom: any) {
|
||||||
child.marginLeft = marginLeft;
|
child.marginLeft = marginLeft;
|
||||||
child.marginTop = marginTop;
|
child.marginTop = marginTop;
|
||||||
|
@ -20,9 +20,9 @@ export class ViewModel extends ViewModelBase {
|
|||||||
public onMinWidthMinHeight(args: { eventName: string, object: any }): void {
|
public onMinWidthMinHeight(args: { eventName: string, object: any }): void {
|
||||||
var view: View = <View>args.object;
|
var view: View = <View>args.object;
|
||||||
if (view.minWidth !== 105) {
|
if (view.minWidth !== 105) {
|
||||||
super.setWidthHeight(view, 105, 55);
|
super.setMinWidthHeight(view, 105, 55);
|
||||||
} else {
|
} else {
|
||||||
super.setWidthHeight(view, 0, 0);
|
super.setMinWidthHeight(view, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ export class ViewModel extends ViewModelBase {
|
|||||||
// MinWidthMinHeight
|
// MinWidthMinHeight
|
||||||
child = layout.getViewById("minWidthMinHeight");
|
child = layout.getViewById("minWidthMinHeight");
|
||||||
if (child.minWidth !== 105) {
|
if (child.minWidth !== 105) {
|
||||||
super.setWidthHeight(child, 105, 55);
|
super.setMinWidthHeight(child, 105, 55);
|
||||||
} else {
|
} else {
|
||||||
super.setWidthHeight(child, 0, 0);
|
super.setMinWidthHeight(child, 0, 0);
|
||||||
}
|
}
|
||||||
// Margins
|
// Margins
|
||||||
child = layout.getViewById("margins");
|
child = layout.getViewById("margins");
|
||||||
|
Reference in New Issue
Block a user