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 ## 🚀 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/ 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
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 ## Building and Using
@ -68,7 +68,7 @@ Avalonia is licenced under the [MIT licence](licence.md).
## Contributors ## 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> <a href="https://github.com/AvaloniaUI/Avalonia/graphs/contributors"><img src="https://opencollective.com/Avalonia/contributors.svg?width=890&button=false" /></a>
### Backers ### Backers

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

@ -917,23 +917,23 @@ namespace Avalonia.Controls
//TODO Cleanup //TODO Cleanup
double? _previousDetailsHeight = null; double? _previousDetailsHeight = null;
//TODO Animation //TODO Animation
private void DetailsContent_SizeChanged(Rect newValue) private void DetailsContent_HeightChanged(double newValue)
{ {
if (_previousDetailsHeight.HasValue) if (_previousDetailsHeight.HasValue)
{ {
var oldValue = _previousDetailsHeight.Value; var oldValue = _previousDetailsHeight.Value;
_previousDetailsHeight = newValue.Height; _previousDetailsHeight = newValue;
if (newValue.Height != oldValue && newValue.Height != _detailsDesiredHeight) if (newValue != oldValue && newValue != _detailsDesiredHeight)
{ {
if (AreDetailsVisible && _appliedDetailsTemplate != null) if (AreDetailsVisible && _appliedDetailsTemplate != null)
{ {
// Update the new desired height for RowDetails // 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 // 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 // to do. In certain scenarios, this could cause a layout cycle
@ -943,19 +943,29 @@ namespace Avalonia.Controls
} }
else else
{ {
_previousDetailsHeight = newValue.Height; _previousDetailsHeight = newValue;
} }
} }
private void DetailsContent_BoundsChanged(Rect newValue)
private void DetailsContent_SizeChanged(Rect newValue)
{ {
if(_detailsContent != null) DetailsContent_HeightChanged(newValue.Height);
DetailsContent_SizeChanged(newValue.Inflate(_detailsContent.Margin));
} }
private void DetailsContent_MarginChanged(Thickness newValue) private void DetailsContent_MarginChanged(Thickness newValue)
{ {
if (_detailsContent != null) if (_detailsContent != null)
DetailsContent_SizeChanged(_detailsContent.Bounds.Inflate(newValue)); 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 //TODO Animation
// Sets AreDetailsVisible on the row and animates if necessary // Sets AreDetailsVisible on the row and animates if necessary
@ -1035,12 +1045,26 @@ namespace Avalonia.Controls
if (_detailsContent != null) if (_detailsContent != null)
{ {
_detailsContentSizeSubscription = if (_detailsContent is Layout.Layoutable layoutableContent)
System.Reactive.Disposables.StableCompositeDisposable.Create( {
_detailsContent.GetObservable(BoundsProperty) layoutableContent.LayoutUpdated += DetailsContent_LayoutUpdated;
.Subscribe(DetailsContent_BoundsChanged),
_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) _detailsContent.GetObservable(MarginProperty)
.Subscribe(DetailsContent_MarginChanged)); .Subscribe(DetailsContent_MarginChanged);
}
_detailsElement.Children.Add(_detailsContent); _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) if (s_lastPress.TryGetTarget(out var target) && target == e.Source)
{ {
var et = e.InitialPressMouseButton != MouseButton.Right ? TappedEvent : RightTappedEvent; if (e.InitialPressMouseButton == MouseButton.Left || e.InitialPressMouseButton == MouseButton.Right)
e.Source.RaiseEvent(new RoutedEventArgs(et)); {
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 System.Collections.Generic;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.UnitTests; using Avalonia.UnitTests;
using Xunit; using Xunit;
namespace Avalonia.Interactivity.UnitTests namespace Avalonia.Input.UnitTests
{ {
public class GesturesTests public class GesturesTests
{ {
@ -45,7 +44,7 @@ namespace Avalonia.Interactivity.UnitTests
} }
[Fact] [Fact]
public void Tapped_Should_Be_Raised_For_Middle_Button() public void Tapped_Should_Not_Be_Raised_For_Middle_Button()
{ {
Border border = new Border(); Border border = new Border();
var decorator = new Decorator var decorator = new Decorator
@ -58,7 +57,7 @@ namespace Avalonia.Interactivity.UnitTests
_mouse.Click(border, MouseButton.Middle); _mouse.Click(border, MouseButton.Middle);
Assert.True(raised); Assert.False(raised);
} }
[Fact] [Fact]

Loading…
Cancel
Save