Browse Source

Merge remote-tracking branch 'origin/master' into fixes/update-tooltip-content-when-already-opened

pull/4574/head
Dan Walmsley 6 years ago
parent
commit
e5d3d007a5
  1. 6
      readme.md
  2. 54
      src/Avalonia.Controls.DataGrid/DataGridRow.cs
  3. 7
      src/Avalonia.Input/Gestures.cs
  4. 7
      tests/Avalonia.Input.UnitTests/GesturesTests.cs

6
readme.md

@ -16,7 +16,7 @@ To see the status of some of our features, please see our [Roadmap](https://gith
## 🚀 Getting Started
The Avalonia [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) contains project and control templates that will help you get started, or you can use the .NET Core CLI. For a starter guide see our [documentation](http://avaloniaui.net/docs/quickstart/create-new-project).
The Avalonia [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) contains project and control templates that will help you get started, or you can use the .NET Core CLI. For a starter guide see our [documentation](https://avaloniaui.net/docs/quickstart/create-new-project).
Avalonia is delivered via <b>NuGet</b> package manager. You can find the packages here: https://www.nuget.org/packages/Avalonia/
@ -47,7 +47,7 @@ We also have a [nightly build](https://github.com/AvaloniaUI/Avalonia/wiki/Using
## Documentation
Documentation can be found on our website at http://avaloniaui.net/docs/. We also have a [tutorial](http://avaloniaui.net/docs/tutorial/) over there for newcomers.
Documentation can be found on our website at https://avaloniaui.net/docs/. We also have a [tutorial](https://avaloniaui.net/docs/tutorial/) over there for newcomers.
## Building and Using
@ -68,7 +68,7 @@ Avalonia is licenced under the [MIT licence](licence.md).
## Contributors
This project exists thanks to all the people who contribute. [[Contribute](http://avaloniaui.net/contributing)].
This project exists thanks to all the people who contribute. [[Contribute](https://avaloniaui.net/contributing)].
<a href="https://github.com/AvaloniaUI/Avalonia/graphs/contributors"><img src="https://opencollective.com/Avalonia/contributors.svg?width=890&button=false" /></a>
### Backers

54
src/Avalonia.Controls.DataGrid/DataGridRow.cs

@ -917,23 +917,23 @@ namespace Avalonia.Controls
//TODO Cleanup
double? _previousDetailsHeight = null;
//TODO Animation
private void DetailsContent_SizeChanged(Rect newValue)
private void DetailsContent_HeightChanged(double newValue)
{
if (_previousDetailsHeight.HasValue)
{
var oldValue = _previousDetailsHeight.Value;
_previousDetailsHeight = newValue.Height;
if (newValue.Height != oldValue && newValue.Height != _detailsDesiredHeight)
_previousDetailsHeight = newValue;
if (newValue != oldValue && newValue != _detailsDesiredHeight)
{
if (AreDetailsVisible && _appliedDetailsTemplate != null)
{
// Update the new desired height for RowDetails
_detailsDesiredHeight = newValue.Height;
_detailsDesiredHeight = newValue;
_detailsElement.ContentHeight = newValue.Height;
_detailsElement.ContentHeight = newValue;
// Calling this when details are not visible invalidates during layout when we have no work
// to do. In certain scenarios, this could cause a layout cycle
@ -943,19 +943,29 @@ namespace Avalonia.Controls
}
else
{
_previousDetailsHeight = newValue.Height;
_previousDetailsHeight = newValue;
}
}
private void DetailsContent_BoundsChanged(Rect newValue)
private void DetailsContent_SizeChanged(Rect newValue)
{
if(_detailsContent != null)
DetailsContent_SizeChanged(newValue.Inflate(_detailsContent.Margin));
DetailsContent_HeightChanged(newValue.Height);
}
private void DetailsContent_MarginChanged(Thickness newValue)
{
if (_detailsContent != null)
DetailsContent_SizeChanged(_detailsContent.Bounds.Inflate(newValue));
}
private void DetailsContent_LayoutUpdated(object sender, EventArgs e)
{
if (_detailsContent != null)
{
var margin = _detailsContent.Margin;
var height = _detailsContent.DesiredSize.Height + margin.Top + margin.Bottom;
DetailsContent_HeightChanged(height);
}
}
//TODO Animation
// Sets AreDetailsVisible on the row and animates if necessary
@ -1035,12 +1045,26 @@ namespace Avalonia.Controls
if (_detailsContent != null)
{
_detailsContentSizeSubscription =
System.Reactive.Disposables.StableCompositeDisposable.Create(
_detailsContent.GetObservable(BoundsProperty)
.Subscribe(DetailsContent_BoundsChanged),
if (_detailsContent is Layout.Layoutable layoutableContent)
{
layoutableContent.LayoutUpdated += DetailsContent_LayoutUpdated;
_detailsContentSizeSubscription =
System.Reactive.Disposables.StableCompositeDisposable.Create(
System.Reactive.Disposables.Disposable.Create(() => layoutableContent.LayoutUpdated -= DetailsContent_LayoutUpdated),
_detailsContent.GetObservable(MarginProperty)
.Subscribe(DetailsContent_MarginChanged));
}
else
{
_detailsContentSizeSubscription =
_detailsContent.GetObservable(MarginProperty)
.Subscribe(DetailsContent_MarginChanged));
.Subscribe(DetailsContent_MarginChanged);
}
_detailsElement.Children.Add(_detailsContent);
}
}

7
src/Avalonia.Input/Gestures.cs

@ -96,8 +96,11 @@ namespace Avalonia.Input
if (s_lastPress.TryGetTarget(out var target) && target == e.Source)
{
var et = e.InitialPressMouseButton != MouseButton.Right ? TappedEvent : RightTappedEvent;
e.Source.RaiseEvent(new RoutedEventArgs(et));
if (e.InitialPressMouseButton == MouseButton.Left || e.InitialPressMouseButton == MouseButton.Right)
{
var et = e.InitialPressMouseButton != MouseButton.Right ? TappedEvent : RightTappedEvent;
e.Source.RaiseEvent(new RoutedEventArgs(et));
}
}
}
}

7
tests/Avalonia.Input.UnitTests/GesturesTests.cs

@ -1,10 +1,9 @@
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.UnitTests;
using Xunit;
namespace Avalonia.Interactivity.UnitTests
namespace Avalonia.Input.UnitTests
{
public class GesturesTests
{
@ -45,7 +44,7 @@ namespace Avalonia.Interactivity.UnitTests
}
[Fact]
public void Tapped_Should_Be_Raised_For_Middle_Button()
public void Tapped_Should_Not_Be_Raised_For_Middle_Button()
{
Border border = new Border();
var decorator = new Decorator
@ -58,7 +57,7 @@ namespace Avalonia.Interactivity.UnitTests
_mouse.Click(border, MouseButton.Middle);
Assert.True(raised);
Assert.False(raised);
}
[Fact]

Loading…
Cancel
Save