Kaynağa Gözat

Merge branch 'master' into alloc-typeutilities

Dariusz Komosiński 6 yıl önce
ebeveyn
işleme
5a5a2907f1

+ 5 - 0
src/Avalonia.Controls/Notifications/ReversibleStackPanel.cs

@@ -39,6 +39,11 @@ namespace Avalonia.Controls
 
             foreach (Control child in children)
             {
+                if (!child.IsVisible)
+                {
+                    continue;
+                }
+
                 double childWidth = child.DesiredSize.Width;
                 double childHeight = child.DesiredSize.Height;
 

+ 1 - 1
src/Avalonia.Controls/StackPanel.cs

@@ -251,7 +251,7 @@ namespace Avalonia.Controls
             {
                 var child = children[i];
 
-                if (child == null)
+                if (child == null || !child.IsVisible)
                 { continue; }
 
                 if (fHorizontal)

+ 0 - 9
src/Avalonia.Input/AccessKeyHandler.cs

@@ -231,15 +231,6 @@ namespace Avalonia.Input
                     }
 
                     break;
-
-                case Key.F10:
-                    _owner.ShowAccessKeys = _showingAccessKeys = true;
-                    if (MainMenu != null)
-                    {
-                        MainMenu.Open();
-                        e.Handled = true;
-                    }
-                    break;
             }
         }
 

+ 25 - 0
tests/Avalonia.Controls.UnitTests/StackPanelTests.cs

@@ -332,6 +332,31 @@ namespace Avalonia.Controls.UnitTests
             Assert.Equal(sizeWithTwoChildren, sizeWithThreeChildren);
         }
 
+        [Theory]
+        [InlineData(Orientation.Horizontal)]
+        [InlineData(Orientation.Vertical)]
+        public void Only_Arrange_Visible_Children(Orientation orientation)
+        {
+
+            var hiddenPanel = new Panel { Width = 10, Height = 10, IsVisible = false };
+            var panel = new Panel { Width = 10, Height = 10 };
+
+            var target = new StackPanel
+            {
+                Spacing = 40,
+                Orientation = orientation,
+                Children =
+                {
+                    hiddenPanel,
+                    panel
+                }
+            };
+
+            target.Measure(Size.Infinity);
+            target.Arrange(new Rect(target.DesiredSize));
+            Assert.Equal(new Rect(0, 0, 10, 10), panel.Bounds);
+        }
+
         private class TestControl : Control
         {
             public Size MeasureConstraint { get; private set; }