fix: #1791
This commit is contained in:
1 parent
2ea451fe82
commit
7a9310c1f1
4 files changed
+31
-18
No files matched your search
@@ -163,6 +163,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = Children.Count; i < count; ++i)
|
||||
{
|
||||
var child = Children[i];
|
||||
if (!child.IsVisible) continue;
|
||||
|
||||
if (itemHorizontalAlignmentSet)
|
||||
{
|
||||
@@ -192,6 +193,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = Children.Count; i < count; i++)
|
||||
{
|
||||
var child = Children[i];
|
||||
if (!child.IsVisible) continue;
|
||||
|
||||
if (itemHorizontalAlignmentSet)
|
||||
{
|
||||
@@ -258,6 +260,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = Children.Count; i < count; i++)
|
||||
{
|
||||
var child = Children[i];
|
||||
if (!child.IsVisible) continue;
|
||||
|
||||
var sz = new PanelUvSize(
|
||||
_orientation,
|
||||
@@ -327,6 +330,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0; i < Children.Count; i++)
|
||||
{
|
||||
Control child = Children[i];
|
||||
if (!child.IsVisible) continue;
|
||||
var childSize = new PanelUvSize(orientation, child.DesiredSize);
|
||||
double layoutSlotU = useItemU ? itemU : childSize.U;
|
||||
|
||||
@@ -354,6 +358,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
var child = Children[i];
|
||||
if (!child.IsVisible) continue;
|
||||
|
||||
var childSize = new PanelUvSize(_orientation, child.DesiredSize);
|
||||
double layoutSlotU = useItemU ? itemU : childSize.U;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -38,12 +39,13 @@ public class CirclePanel : Panel
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
var diameter = Diameter;
|
||||
var layoutChildren = Children.OfType<UIElement>().Where(element => element.Visibility != Visibility.Collapsed).ToList();
|
||||
|
||||
if (Children.Count == 0) return new Size(diameter, diameter);
|
||||
if (layoutChildren.Count == 0) return new Size(diameter, diameter);
|
||||
|
||||
var newSize = new Size(diameter, diameter);
|
||||
|
||||
foreach (UIElement element in Children)
|
||||
foreach (var element in layoutChildren)
|
||||
{
|
||||
element.Measure(newSize);
|
||||
}
|
||||
@@ -55,12 +57,18 @@ public class CirclePanel : Panel
|
||||
{
|
||||
var keepVertical = KeepVertical;
|
||||
var offsetAngle = OffsetAngle;
|
||||
var layoutChildren = Children.OfType<UIElement>().Where(element => element.Visibility != Visibility.Collapsed).ToList();
|
||||
|
||||
if (layoutChildren.Count == 0)
|
||||
{
|
||||
return finalSize;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var perDeg = 360.0 / Children.Count;
|
||||
var perDeg = 360.0 / layoutChildren.Count;
|
||||
var radius = Diameter / 2;
|
||||
|
||||
foreach (UIElement element in Children)
|
||||
foreach (var element in layoutChildren)
|
||||
{
|
||||
var centerX = element.DesiredSize.Width / 2.0;
|
||||
var centerY = element.DesiredSize.Height / 2.0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
@@ -60,21 +61,19 @@ public class HoneycombPanel : Panel
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
var maxSize = new Size();
|
||||
var layoutChildren = InternalChildren.Cast<UIElement>().Where(child => child != null && child.Visibility != Visibility.Collapsed).ToList();
|
||||
|
||||
foreach (UIElement child in InternalChildren)
|
||||
foreach (var child in layoutChildren)
|
||||
{
|
||||
if (child != null)
|
||||
{
|
||||
child.Measure(availableSize);
|
||||
maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width);
|
||||
maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height);
|
||||
}
|
||||
child.Measure(availableSize);
|
||||
maxSize.Width = Math.Max(maxSize.Width, child.DesiredSize.Width);
|
||||
maxSize.Height = Math.Max(maxSize.Height, child.DesiredSize.Height);
|
||||
}
|
||||
|
||||
_unitLength = Math.Max(maxSize.Width, maxSize.Height) / 2;
|
||||
|
||||
var xCount = GetXCount(InternalChildren.Count);
|
||||
var yCount = GetYCount(InternalChildren.Count);
|
||||
var xCount = GetXCount(layoutChildren.Count);
|
||||
var yCount = GetYCount(layoutChildren.Count);
|
||||
|
||||
var availableWidth = xCount * _unitLength;
|
||||
var availableHeight = yCount * Math.Pow(3, 0.5) * _unitLength + _unitLength * 2;
|
||||
@@ -90,6 +89,7 @@ public class HoneycombPanel : Panel
|
||||
|
||||
foreach (UIElement child in InternalChildren)
|
||||
{
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
child.Arrange(_stuffer.Move());
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (var i = start; i < end; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
if (child == null) continue;
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
|
||||
var childSize = new PanelUvSize(_orientation, child.DesiredSize);
|
||||
var layoutSlotU = useItemU ? itemU : childSize.U;
|
||||
@@ -161,7 +161,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (var i = 0; i < children.Count; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
if (child == null) continue;
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
|
||||
var childSize = new PanelUvSize(_orientation, child.DesiredSize);
|
||||
var layoutSlotU = useItemU ? itemU : childSize.U;
|
||||
@@ -214,7 +214,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = children.Count; i < count; ++i)
|
||||
{
|
||||
var child = children[i];
|
||||
if (child == null) continue;
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
|
||||
if (itemHorizontalAlignmentSet)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = children.Count; i < count; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
if (child == null) continue;
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
|
||||
if (itemHorizontalAlignmentSet)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ public class UniformSpacingPanel : Panel
|
||||
for (int i = 0, count = children.Count; i < count; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
if (child == null) continue;
|
||||
if (child == null || child.Visibility == Visibility.Collapsed) continue;
|
||||
|
||||
var sz = new PanelUvSize(
|
||||
_orientation,
|
||||
|
||||
Reference in new issue
Block a user