[view] add Geometry size ratio param

This commit is contained in:
2019-04-17 16:42:26 +03:00
parent c5002ec3fe
commit 3638c8d2b6
5 changed files with 60 additions and 1 deletions

View File

@@ -98,6 +98,13 @@ class View<C:DisplayObject> implements IView<C> {
if (width != value) {
width = value;
toRedraw();
if (geometry != null && geometry.size.ratio > -1) {
var ratioHeight = value / geometry.size.ratio;
var size = geometry.size.content["ratio.height"];
if (size == null || size.height != ratioHeight) {
this.setContentSize(-1, ratioHeight, "ratio.height");
}
}
}
return width;
}
@@ -106,6 +113,13 @@ class View<C:DisplayObject> implements IView<C> {
if (height != value) {
height = value;
toRedraw();
if (geometry != null && geometry.size.ratio > -1) {
var ratioWidth = value * geometry.size.ratio;
var size = geometry.size.content["ratio.width"];
if (size == null || size.width != ratioWidth) {
this.setContentSize(ratioWidth, -1, "ratio.width");
}
}
}
return height;
}