/// <summary> /// <para>Constructs a new instance of the <see cref="AssetIconsCompiledStyle"/> from a <see cref="AssetIconsStyle"/>.</para> /// </summary> public AssetIconsCompiledStyle(AssetIconsStyle style) { MaxSize = style.MaxSize; Aspect = style.Aspect; Anchor = AnchorToVector(style.Anchor); Layer = style.Layer; Tint = ExpressionParser.ParseHexColor(style.Tint); FontStyle = style.FontStyle; TextAnchor = ToTextAnchor(style.TextAnchor); Projection = style.Projection; Positioning = new PositioningProcessor(this, style); }
public PositioningProcessor(AssetIconsCompiledStyle compiledStyleDefinition, AssetIconsStyle style) { widthProvider = new StaticValueProvider(new MathValue(1.0f, true)); heightProvider = new StaticValueProvider(new MathValue(1.0f, true)); var horizontalContext = new MathContextBuilder() .WithTerm("width", widthProvider) .WithTerm("height", heightProvider) .ImplicitlyReferences(widthProvider) .Build(); var verticalContext = new MathContextBuilder() .WithTerm("width", widthProvider) .WithTerm("height", heightProvider) .ImplicitlyReferences(heightProvider) .Build(); compiledWidth = CompiledExpression.Compile(style.Width, horizontalContext); compiledHeight = CompiledExpression.Compile(style.Height, verticalContext); compiledX = CompiledExpression.Compile(style.X, horizontalContext); compiledY = CompiledExpression.Compile(style.Y, verticalContext); compiledDisplay = CompiledExpression.Compile(style.Display, horizontalContext); styleAnchoring = compiledStyleDefinition.Anchor; }