Fix myview test page in layouts suit

This commit is contained in:
Svetoslav Tsenov
2017-05-01 23:29:38 +03:00
parent caa093fea6
commit 864bbb81d0
3 changed files with 21 additions and 6 deletions

View File

@ -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 {
let child: any;
let layout: any = args.object.parent;
@ -41,9 +51,9 @@ export class ViewModelWithPercentage extends ViewModelBase {
// MinWidthMinHeight
child = <View>layout.getViewById("minWidthMinHeight");
if (child.minWidth !== 105) {
super.setWidthHeight(child, 105, 55);
super.setMinWidthHeight(child, 105, 55);
} else {
super.setWidthHeight(child, 0, 0);
super.setMinWidthHeight(child, 0, 0);
}
// Margins

View File

@ -35,6 +35,11 @@ export class ViewModelBase extends Observable {
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) {
child.marginLeft = marginLeft;
child.marginTop = marginTop;

View File

@ -20,9 +20,9 @@ export class ViewModel extends ViewModelBase {
public onMinWidthMinHeight(args: { eventName: string, object: any }): void {
var view: View = <View>args.object;
if (view.minWidth !== 105) {
super.setWidthHeight(view, 105, 55);
super.setMinWidthHeight(view, 105, 55);
} else {
super.setWidthHeight(view, 0, 0);
super.setMinWidthHeight(view, 0, 0);
}
}
@ -50,9 +50,9 @@ export class ViewModel extends ViewModelBase {
// MinWidthMinHeight
child = layout.getViewById("minWidthMinHeight");
if (child.minWidth !== 105) {
super.setWidthHeight(child, 105, 55);
super.setMinWidthHeight(child, 105, 55);
} else {
super.setWidthHeight(child, 0, 0);
super.setMinWidthHeight(child, 0, 0);
}
// Margins
child = layout.getViewById("margins");