Browse Source

some fixes

pull/7810/head
daniel mayost 4 years ago
parent
commit
dd8787c98a
  1. 20
      src/Avalonia.Controls/Control.cs
  2. 4
      src/Avalonia.Visuals/ApiCompatBaseline.txt
  3. 2
      src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
  4. 2
      src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs
  5. 16
      src/Avalonia.Visuals/Visual.cs
  6. 2
      src/Avalonia.Visuals/VisualExtensions.cs
  7. 2
      src/Avalonia.Visuals/VisualTree/IVisual.cs

20
src/Avalonia.Controls/Control.cs

@ -367,35 +367,35 @@ namespace Avalonia.Controls
}
/// <summary>
/// Computes the <see cref="IVisual.IsMirrorTransform"/> value according to the
/// Computes the <see cref="IVisual.HasMirrorTransform"/> value according to the
/// <see cref="FlowDirection"/> and <see cref="BypassFlowDirectionPolicies"/>
/// </summary>
public virtual void InvalidateFlowDirection()
{
FlowDirection thisFD = this.FlowDirection;
FlowDirection parentFD = FlowDirection.LeftToRight;
var flowDirection = this.FlowDirection;
var parentFlowDirection = FlowDirection.LeftToRight;
bool thisBypassFlowDirectionPolicies = BypassFlowDirectionPolicies;
bool bypassFlowDirectionPolicies = BypassFlowDirectionPolicies;
bool parentBypassFlowDirectionPolicies = false;
var parent = this.FindAncestorOfType<Control>();
if (parent != null)
{
parentFD = parent.FlowDirection;
parentFlowDirection = parent.FlowDirection;
parentBypassFlowDirectionPolicies = parent.BypassFlowDirectionPolicies;
}
else if (this.Parent is Control logicalParent)
else if (Parent is Control logicalParent)
{
parentFD = logicalParent.FlowDirection;
parentFlowDirection = logicalParent.FlowDirection;
parentBypassFlowDirectionPolicies = logicalParent.BypassFlowDirectionPolicies;
}
bool thisShouldBeMirrored = thisFD == FlowDirection.RightToLeft && !BypassFlowDirectionPolicies;
bool parentShouldBeMirrored = parentFD == FlowDirection.RightToLeft && !parentBypassFlowDirectionPolicies;
bool thisShouldBeMirrored = flowDirection == FlowDirection.RightToLeft && !bypassFlowDirectionPolicies;
bool parentShouldBeMirrored = parentFlowDirection == FlowDirection.RightToLeft && !parentBypassFlowDirectionPolicies;
bool shouldApplyMirrorTransform = thisShouldBeMirrored != parentShouldBeMirrored;
IsMirrorTransform = shouldApplyMirrorTransform;
HasMirrorTransform = shouldApplyMirrorTransform;
}
}
}

4
src/Avalonia.Visuals/ApiCompatBaseline.txt

@ -182,7 +182,7 @@ InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Media.TextFo
InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Media.GlyphRun Avalonia.Platform.ITextShaperImpl.ShapeText(Avalonia.Utilities.ReadOnlySlice<System.Char>, Avalonia.Media.Typeface, System.Double, System.Globalization.CultureInfo)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public Avalonia.Media.GlyphRun Avalonia.Platform.ITextShaperImpl.ShapeText(Avalonia.Utilities.ReadOnlySlice<System.Char>, Avalonia.Media.Typeface, System.Double, System.Globalization.CultureInfo)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'protected void Avalonia.Rendering.RendererBase.RenderFps(Avalonia.Platform.IDrawingContextImpl, Avalonia.Rect, System.Nullable<System.Int32>)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.VisualTree.IVisual.IsMirrorTransform' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.VisualTree.IVisual.IsMirrorTransform.get()' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.VisualTree.IVisual.HasMirrorTransform' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean Avalonia.VisualTree.IVisual.HasMirrorTransform.get()' is present in the implementation but not in the contract.
MembersMustExist : Member 'public void Avalonia.Utilities.ReadOnlySlice<T>..ctor(System.ReadOnlyMemory<T>, System.Int32, System.Int32)' does not exist in the implementation but it does exist in the contract.
Total Issues: 186

2
src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs

@ -285,7 +285,7 @@ namespace Avalonia.Rendering
renderTransform = (-offset) * visual.RenderTransform.Value * (offset);
}
if (visual.IsMirrorTransform)
if (visual.HasMirrorTransform)
{
var mirrorMatrix = new Matrix(-1.0, 0.0, 0.0, 1.0, visual.Bounds.Width, 0);
renderTransform *= mirrorMatrix;

2
src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs

@ -195,7 +195,7 @@ namespace Avalonia.Rendering.SceneGraph
renderTransform = (-offset) * visual.RenderTransform.Value * (offset);
}
if (visual.IsMirrorTransform)
if (visual.HasMirrorTransform)
{
var mirrorMatrix = new Matrix(-1.0, 0.0, 0.0, 1.0, visual.Bounds.Width, 0);
renderTransform *= mirrorMatrix;

16
src/Avalonia.Visuals/Visual.cs

@ -69,10 +69,10 @@ namespace Avalonia
AvaloniaProperty.Register<Visual, IBrush?>(nameof(OpacityMask));
/// <summary>
/// Defines the <see cref="IsMirrorTransform"/> property.
/// Defines the <see cref="HasMirrorTransform"/> property.
/// </summary>
public static readonly DirectProperty<Visual, bool> IsMirrorTransformProperty =
AvaloniaProperty.RegisterDirect<Visual, bool>(nameof(IsMirrorTransform), o => o.IsMirrorTransform);
public static readonly DirectProperty<Visual, bool> HasMirrorTransformProperty =
AvaloniaProperty.RegisterDirect<Visual, bool>(nameof(HasMirrorTransform), o => o.HasMirrorTransform);
/// <summary>
/// Defines the <see cref="RenderTransform"/> property.
@ -102,7 +102,7 @@ namespace Avalonia
private TransformedBounds? _transformedBounds;
private IRenderRoot? _visualRoot;
private IVisual? _visualParent;
private bool _isMirrorTransform;
private bool _hasMirrorTransform;
/// <summary>
/// Initializes static members of the <see cref="Visual"/> class.
@ -115,7 +115,7 @@ namespace Avalonia
ClipToBoundsProperty,
IsVisibleProperty,
OpacityProperty,
IsMirrorTransformProperty);
HasMirrorTransformProperty);
RenderTransformProperty.Changed.Subscribe(RenderTransformChanged);
ZIndexProperty.Changed.Subscribe(ZIndexChanged);
}
@ -230,10 +230,10 @@ namespace Avalonia
/// <summary>
/// Gets or sets a value indicating whether to apply mirror transform on this control.
/// </summary>
public bool IsMirrorTransform
public bool HasMirrorTransform
{
get { return _isMirrorTransform; }
protected set { SetAndRaise(IsMirrorTransformProperty, ref _isMirrorTransform, value); }
get { return _hasMirrorTransform; }
protected set { SetAndRaise(HasMirrorTransformProperty, ref _hasMirrorTransform, value); }
}
/// <summary>

2
src/Avalonia.Visuals/VisualExtensions.cs

@ -110,7 +110,7 @@ namespace Avalonia
result *= renderTransform;
}
if (v.IsMirrorTransform)
if (v.HasMirrorTransform)
{
var mirrorMatrix = new Matrix(-1.0, 0.0, 0.0, 1.0, v.Bounds.Width, 0);
result *= mirrorMatrix;

2
src/Avalonia.Visuals/VisualTree/IVisual.cs

@ -78,7 +78,7 @@ namespace Avalonia.VisualTree
/// <summary>
/// Gets a value indicating whether to apply mirror transform on this control.
/// </summary>
bool IsMirrorTransform { get; }
bool HasMirrorTransform { get; }
/// <summary>
/// Gets or sets the render transform of the control.

Loading…
Cancel
Save