TimLariviere / Fabulous-new

Fabulous v2 - Work in progress
https://timothelariviere.com/Fabulous-new/
Other
41 stars 3 forks source link

RelativeLayout missing support for RelativeToView #93

Open edgarfgp opened 2 years ago

edgarfgp commented 2 years ago

RelativeToView is missing from v1 and V2 . Would be good to see if there is anyway we can support this as we move forward to stable 2.0

public static Constraint RelativeToView(View view, Func<RelativeLayout, View, double> measure)
{
    var result = new Constraint { _measureFunc = layout => measure(layout, view), RelativeTo = new[] { view } };

    return result;
}

internal static BoundsConstraint FromExpression(Expression<Func> expression, bool fromExpression, IEnumerable parents = null) { Func compiled = expression.Compile(); var result = new BoundsConstraint { _measureFunc = compiled, RelativeTo = parents ?? ExpressionSearch.Default.FindObjects(expression).ToArray(), // make sure we have our own copy CreatedFromExpression = fromExpression };

return result;

}