private bool TryApplyLayout(ref Vector2 position, ref Vector2 localScale, ref Vector2 scale, ref Matrix matrix) { if (parent != null) { if (!parent.TryApplyLayout(ref position, ref localScale, ref scale, ref matrix)) { return(false); } } if ((scale.X != 0 && scale.Y != 0)) { Vector2 size = ElementSize; GetDisplayMatrix(out matrix, scale, ref size); if (!UseSize) { size = new Vector2(1, 1); } else if (IsNormalised) { size *= scale; } scale = size; Vector2.Transform(ref position, ref matrix, out position); Vector2.TransformNormal(ref localScale, ref matrix, out localScale); return(true); } return(false); }