Browse Source

Merge branch 'master' into pointerover-fixes

pull/8918/head
Max Katz 4 years ago
committed by GitHub
parent
commit
cc3e7e3f58
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Avalonia.Base/Data/Core/Plugins/ObservableStreamPlugin.cs
  2. 2
      src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs
  3. 2
      src/Avalonia.Base/Layout/FlowLayoutAlgorithm.cs
  4. 10
      src/Avalonia.Base/Media/TextTrimming.cs
  5. 2
      src/Avalonia.Base/Media/UnicodeRange.cs
  6. 2
      src/Avalonia.Base/Utilities/IWeakSubscriber.cs
  7. 2
      src/Avalonia.Controls/Window.cs
  8. 1
      src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj
  9. 6
      src/Web/Avalonia.Web.Blazor/AvaloniaView.razor
  10. 6
      src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs
  11. 16
      src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs
  12. 4
      src/tools/DevGenerators/CompositionGenerator/Generator.cs
  13. 2
      tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs

2
src/Avalonia.Base/Data/Core/Plugins/ObservableStreamPlugin.cs

@ -42,7 +42,7 @@ namespace Avalonia.Data.Core.Plugins
if (target is IObservable<object?> result)
{
return result;
};
}
// If the observable returns a value type then we need to call Observable.Select on it.
// First get the type of T in `IObservable<T>`.

2
src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs

@ -71,7 +71,7 @@ namespace Avalonia.Input.GestureRecognizers
{
EndGesture();
_tracking = e.Pointer;
_gestureId = ScrollGestureEventArgs.GetNextFreeId();;
_gestureId = ScrollGestureEventArgs.GetNextFreeId();
_trackedRootPoint = e.GetPosition(_target);
}
}

2
src/Avalonia.Base/Layout/FlowLayoutAlgorithm.cs

@ -523,7 +523,7 @@ namespace Avalonia.Layout
{
firstRealizedElement = _elementManager.GetAt(0);
firstBounds = _elementManager.GetLayoutBoundsForRealizedIndex(0);
firstDataIndex = _elementManager.GetDataIndexFromRealizedRangeIndex(0);;
firstDataIndex = _elementManager.GetDataIndexFromRealizedRangeIndex(0);
int last = _elementManager.GetRealizedElementCount() - 1;
lastRealizedElement = _elementManager.GetAt(last);

10
src/Avalonia.Base/Media/TextTrimming.cs

@ -8,7 +8,7 @@ namespace Avalonia.Media
/// </summary>
public abstract class TextTrimming
{
public static char s_defaultEllipsisChar = '\u2026';
internal const char DefaultEllipsisChar = '\u2026';
/// <summary>
/// Text is not trimmed.
@ -18,22 +18,22 @@ namespace Avalonia.Media
/// <summary>
/// Text is trimmed at a character boundary. An ellipsis (...) is drawn in place of remaining text.
/// </summary>
public static TextTrimming CharacterEllipsis { get; } = new TextTrailingTrimming(s_defaultEllipsisChar, false);
public static TextTrimming CharacterEllipsis { get; } = new TextTrailingTrimming(DefaultEllipsisChar, false);
/// <summary>
/// Text is trimmed at a word boundary. An ellipsis (...) is drawn in place of remaining text.
/// </summary>
public static TextTrimming WordEllipsis { get; } = new TextTrailingTrimming(s_defaultEllipsisChar, true);
public static TextTrimming WordEllipsis { get; } = new TextTrailingTrimming(DefaultEllipsisChar, true);
/// <summary>
/// Text is trimmed after a given prefix length. An ellipsis (...) is drawn in between prefix and suffix and represents remaining text.
/// </summary>
public static TextTrimming PrefixCharacterEllipsis { get; } = new TextLeadingPrefixTrimming(s_defaultEllipsisChar, 8);
public static TextTrimming PrefixCharacterEllipsis { get; } = new TextLeadingPrefixTrimming(DefaultEllipsisChar, 8);
/// <summary>
/// Text is trimmed at a character boundary starting from the beginning. An ellipsis (...) is drawn in place of remaining text.
/// </summary>
public static TextTrimming LeadingCharacterEllipsis { get; } = new TextLeadingPrefixTrimming(s_defaultEllipsisChar, 0);
public static TextTrimming LeadingCharacterEllipsis { get; } = new TextLeadingPrefixTrimming(DefaultEllipsisChar, 0);
/// <summary>
/// Creates properties that will be used for collapsing lines of text.

2
src/Avalonia.Base/Media/UnicodeRange.cs

@ -9,7 +9,7 @@ namespace Avalonia.Media
/// </summary>
public readonly struct UnicodeRange
{
public static UnicodeRange Default = Parse("0-10FFFD");
public readonly static UnicodeRange Default = Parse("0-10FFFD");
private readonly UnicodeRangeSegment _single;
private readonly IReadOnlyList<UnicodeRangeSegment>? _segments = null;

2
src/Avalonia.Base/Utilities/IWeakSubscriber.cs

@ -3,7 +3,7 @@ using System;
namespace Avalonia.Utilities
{
/// <summary>
/// Defines a listener to a event subscribed vis the <see cref="WeakSubscriptionManager"/>.
/// Defines a listener to a event subscribed vis the <see cref="WeakObservable"/>.
/// </summary>
/// <typeparam name="T">The type of the event arguments.</typeparam>
public interface IWeakSubscriber<T> where T : EventArgs

2
src/Avalonia.Controls/Window.cs

@ -378,8 +378,6 @@ namespace Avalonia.Controls
/// <summary>
/// Enables or disables resizing of the window.
/// Note that if <see cref="HasSystemDecorations"/> is set to False then this property
/// has no effect and should be treated as a recommendation for the user setting HasSystemDecorations.
/// </summary>
public bool CanResize
{

1
src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj

@ -32,7 +32,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.8" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.7.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
</ItemGroup>
<ItemGroup>

6
src/Web/Avalonia.Web.Blazor/AvaloniaView.razor

@ -3,9 +3,9 @@
tabindex="0" oncontextmenu="return false;"
@onwheel="OnWheel"
@onkeydown="OnKeyDown"
@onkeydown:preventDefault="true"
@onkeyup="OnKeyUp"
@onkeyup:preventDefault="true"
@onkeyup:preventDefault="@KeyPreventDefault"
@onkeydown:preventDefault="@KeyPreventDefault"
@onpointerdown="OnPointerDown"
@onpointerup="OnPointerUp"
@onpointermove="OnPointerMove"
@ -20,8 +20,6 @@
onpaste="return false;"
oncopy="return false;"
oncut="return false;"
@onkeydown:preventDefault="true"
@onkeyup:preventDefault="true"
autocapitalize="none"/>
</div>

6
src/Web/Avalonia.Web.Blazor/AvaloniaView.razor.cs

@ -63,6 +63,8 @@ namespace Avalonia.Web.Blazor
}
}
public bool KeyPreventDefault { get; set; }
internal INativeControlHostImpl GetNativeControlHostImpl()
{
return _nativeControlHost ?? throw new InvalidOperationException("Blazor View wasn't initialized yet");
@ -203,12 +205,12 @@ namespace Avalonia.Web.Blazor
private void OnKeyDown(KeyboardEventArgs e)
{
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, e.Code, e.Key, GetModifiers(e));
KeyPreventDefault = _topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyDown, e.Code, e.Key, GetModifiers(e));
}
private void OnKeyUp(KeyboardEventArgs e)
{
_topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyUp, e.Code, e.Key, GetModifiers(e));
KeyPreventDefault = _topLevelImpl.RawKeyboardEvent(RawKeyEventType.KeyUp, e.Code, e.Key, GetModifiers(e));
}
private void OnFocus(FocusEventArgs e)

16
src/Web/Avalonia.Web.Blazor/RazorViewTopLevelImpl.cs

@ -113,22 +113,32 @@ namespace Avalonia.Web.Blazor
}
}
public void RawKeyboardEvent(RawKeyEventType type, string code, string key, RawInputModifiers modifiers)
public bool RawKeyboardEvent(RawKeyEventType type, string code, string key, RawInputModifiers modifiers)
{
if (Keycodes.KeyCodes.TryGetValue(code, out var avkey))
{
if (_inputRoot is { })
{
Input?.Invoke(new RawKeyEventArgs(KeyboardDevice, Timestamp, _inputRoot, type, avkey, modifiers));
var args = new RawKeyEventArgs(KeyboardDevice, Timestamp, _inputRoot, type, avkey, modifiers);
Input?.Invoke(args);
return args.Handled;
}
}
else if (Keycodes.KeyCodes.TryGetValue(key, out avkey))
{
if (_inputRoot is { })
{
Input?.Invoke(new RawKeyEventArgs(KeyboardDevice, Timestamp, _inputRoot, type, avkey, modifiers));
var args = new RawKeyEventArgs(KeyboardDevice, Timestamp, _inputRoot, type, avkey, modifiers);
Input?.Invoke(args);
return args.Handled;
}
}
return false;
}
public void RawTextEvent(string text)

4
src/tools/DevGenerators/CompositionGenerator/Generator.cs

@ -133,10 +133,6 @@ namespace Avalonia.SourceGenerator.CompositionGenerator
MethodDeclaration(ParseTypeName("void"), "Initialize")
.AddModifiers(SyntaxKind.PartialKeyword).WithSemicolonToken(Semicolon()));
var changesVarName = "c";
var changesVar = IdentifierName(changesVarName);
server = server.AddMembers(
MethodDeclaration(ParseTypeName("void"), "DeserializeChangesExtra")
.AddParameterListParameters(Parameter(Identifier("c")).WithType(ParseTypeName("BatchStreamReader")))

2
tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs

@ -389,7 +389,7 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting
if (textLine.Width > 300 || currentHeight + textLine.Height > 240)
{
textLine = textLine.Collapse(new TextTrailingWordEllipsis(new ReadOnlySlice<char>(new[] { TextTrimming.s_defaultEllipsisChar }), 300, defaultProperties));
textLine = textLine.Collapse(new TextTrailingWordEllipsis(new ReadOnlySlice<char>(new[] { TextTrimming.DefaultEllipsisChar }), 300, defaultProperties));
}
currentHeight += textLine.Height;

Loading…
Cancel
Save