Merge pull request #4090 from NativeScript/test-pages-fixes

Fix myview test page from layouts suit
This commit is contained in:
dtopuzov
2017-05-02 09:23:30 +03:00
committed by GitHub
3 changed files with 21 additions and 7 deletions

View File

@@ -26,6 +26,15 @@ 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 +50,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;
@@ -72,4 +77,4 @@ export class ViewModelBase extends Observable {
child.visibility = "visible";
}
}
}
}

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");