[view] add Geometry size ratio param
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user