|
@@ -185,12 +185,6 @@ class FlowProperties {
|
|
|
**/
|
|
|
public var constraint = true;
|
|
|
|
|
|
- /**
|
|
|
- When set, if a size constraint exists on the parent, element will be constrainted by the remaining space from non-flexible elements.
|
|
|
- If the parent flow contains multiple flexible elements, the remaining space will be shared according to their weights.
|
|
|
- **/
|
|
|
- public var flexWeight : Null<Float>;
|
|
|
-
|
|
|
@:dox(hide)
|
|
|
public function new(elt) {
|
|
|
this.elt = elt;
|
|
@@ -1198,36 +1192,6 @@ class Flow extends Object {
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
- var flexibleWidth = maxInWidth;
|
|
|
- var numFlexible = 0;
|
|
|
- var totFlexWeight = 0.0;
|
|
|
- for( i in 0...children.length ) {
|
|
|
- var p = propAt(i);
|
|
|
- var c = childAt(i);
|
|
|
- if( p.isAbsolute || !c.visible ) continue;
|
|
|
- if( p.isBreak ) {
|
|
|
- flexibleWidth = maxInWidth;
|
|
|
- continue;
|
|
|
- }
|
|
|
- flexibleWidth -= horizontalSpacing;
|
|
|
- if( p.flexWeight > 0 ) {
|
|
|
- numFlexible++;
|
|
|
- totFlexWeight += p.flexWeight;
|
|
|
- }
|
|
|
- else {
|
|
|
- var pw = p.paddingLeft + p.paddingRight;
|
|
|
- var ph = p.paddingTop + p.paddingBottom;
|
|
|
- c.constraintSize(
|
|
|
- isConstraintWidth && p.constraint ? (maxInWidth - pw) / Math.abs(c.scaleX) : -1,
|
|
|
- isConstraintHeight && p.constraint ? (maxInHeight - ph) / Math.abs(c.scaleX) : -1
|
|
|
- );
|
|
|
- flexibleWidth -= Math.ceil(getSize(c).xMax) + pw;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if( flexibleWidth < maxInWidth )
|
|
|
- flexibleWidth += horizontalSpacing;
|
|
|
-
|
|
|
for( i in 0...children.length ) {
|
|
|
var p = propAt(i);
|
|
|
var isAbs = p.isAbsolute;
|
|
@@ -1239,7 +1203,7 @@ class Flow extends Object {
|
|
|
var ph = p.paddingTop + p.paddingBottom;
|
|
|
if( !isAbs )
|
|
|
c.constraintSize(
|
|
|
- isConstraintWidth && p.constraint ? ((p.flexWeight > 0 ? Math.floor(flexibleWidth * p.flexWeight / totFlexWeight) : maxInWidth) - pw) / Math.abs(c.scaleX) : -1,
|
|
|
+ isConstraintWidth && p.constraint ? (maxInWidth - pw) / Math.abs(c.scaleX) : -1,
|
|
|
isConstraintHeight && p.constraint ? (maxInHeight - ph) / Math.abs(c.scaleX) : -1
|
|
|
);
|
|
|
|
|
@@ -1375,36 +1339,6 @@ class Flow extends Object {
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
- var flexibleHeight = maxInHeight;
|
|
|
- var numFlexible = 0;
|
|
|
- var totFlexWeight = 0.0;
|
|
|
- for( i in 0...children.length ) {
|
|
|
- var p = propAt(i);
|
|
|
- var c = childAt(i);
|
|
|
- if( p.isAbsolute || !c.visible ) continue;
|
|
|
- if( p.isBreak ) {
|
|
|
- flexibleHeight = maxInHeight;
|
|
|
- continue;
|
|
|
- }
|
|
|
- flexibleHeight -= verticalSpacing;
|
|
|
- if( p.flexWeight > 0 ) {
|
|
|
- numFlexible++;
|
|
|
- totFlexWeight += p.flexWeight;
|
|
|
- }
|
|
|
- else {
|
|
|
- var pw = p.paddingLeft + p.paddingRight;
|
|
|
- var ph = p.paddingTop + p.paddingBottom;
|
|
|
- c.constraintSize(
|
|
|
- isConstraintWidth && p.constraint ? (maxInWidth - pw) / Math.abs(c.scaleX) : -1,
|
|
|
- isConstraintHeight && p.constraint ? (maxInHeight - ph) / Math.abs(c.scaleX) : -1
|
|
|
- );
|
|
|
- flexibleHeight -= Math.ceil(getSize(c).yMax) + ph;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if( flexibleHeight < maxInHeight )
|
|
|
- flexibleHeight += verticalSpacing;
|
|
|
-
|
|
|
for( i in 0...children.length ) {
|
|
|
var p = propAt(i);
|
|
|
var isAbs = p.isAbsolute;
|
|
@@ -1418,7 +1352,7 @@ class Flow extends Object {
|
|
|
if( !isAbs )
|
|
|
c.constraintSize(
|
|
|
isConstraintWidth && p.constraint ? (maxInWidth - pw) / Math.abs(c.scaleX) : -1,
|
|
|
- isConstraintHeight && p.constraint ? ((p.flexWeight > 0 ? Math.floor(flexibleHeight * p.flexWeight / totFlexWeight) : maxInHeight) - ph) / Math.abs(c.scaleY) : -1
|
|
|
+ isConstraintHeight && p.constraint ? (maxInHeight - ph) / Math.abs(c.scaleY) : -1
|
|
|
);
|
|
|
|
|
|
var b = getSize(c);
|