From 48ad2176e4ddbd240bc0dc4529df989341306a08 Mon Sep 17 00:00:00 2001 From: Windmill-City <1449182174@qq.com> Date: Sat, 1 Feb 2020 11:56:58 +0800 Subject: [PATCH 1/4] Fix wrong navigation action --- src/InteractiveDataDisplay.WPF.csproj | 2 +- src/Navigation/MouseNavigation.cs | 2 +- src/Themes/Generic.xaml | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/InteractiveDataDisplay.WPF.csproj b/src/InteractiveDataDisplay.WPF.csproj index f5bd771..6cfb718 100644 --- a/src/InteractiveDataDisplay.WPF.csproj +++ b/src/InteractiveDataDisplay.WPF.csproj @@ -34,7 +34,7 @@ $(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets - 1.1.0 + 1.1.1 Microsoft; MSU ITIS Lab Sergey Berezin, Vassily Lyutsarev, Nikita Skoblov, Natalia Stepanova Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. diff --git a/src/Navigation/MouseNavigation.cs b/src/Navigation/MouseNavigation.cs index f2e284e..c387b78 100644 --- a/src/Navigation/MouseNavigation.cs +++ b/src/Navigation/MouseNavigation.cs @@ -416,7 +416,7 @@ private bool HandleMouseDown(MouseEventArgs e) else { DateTime d = DateTime.Now; - if ((d - lastClick).TotalMilliseconds < 200) + if ((d - lastClick).TotalMilliseconds < 200 && IsVerticalNavigationEnabled && IsHorizontalNavigationEnabled) { masterPlot.IsAutoFitEnabled = true; return true; diff --git a/src/Themes/Generic.xaml b/src/Themes/Generic.xaml index 7a1788d..53f28ed 100644 --- a/src/Themes/Generic.xaml +++ b/src/Themes/Generic.xaml @@ -30,7 +30,8 @@ - - + - + Date: Sat, 1 Feb 2020 21:03:05 +0800 Subject: [PATCH 2/4] Fix Figure Padding --- src/Figure.cs | 79 ++++++++++++++++++++++++++--------------- src/Themes/Generic.xaml | 5 +-- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/Figure.cs b/src/Figure.cs index 2923e2d..61ad719 100644 --- a/src/Figure.cs +++ b/src/Figure.cs @@ -101,12 +101,13 @@ public Thickness ExtraPadding /// Padding with maximum values for each side from padding of all children protected override Thickness AggregatePadding() { - var ep = base.AggregatePadding(); - return new Thickness( - ep.Left + ExtraPadding.Left, - ep.Top + ExtraPadding.Top, - ep.Right + ExtraPadding.Right, - ep.Bottom + ExtraPadding.Bottom); + return ExtraPadding; + } + + // Helper function to add up the left and right size as width, as well as the top and bottom size as height + private static Size HelperCollapseThickness(Thickness th) + { + return new Size(th.Left + th.Right, th.Top + th.Bottom); } /// @@ -138,9 +139,18 @@ protected override Size MeasureOverride(Size availableSize) //then meassuring left and right with top and bottom output values // Create transform for first iteration + + //Handle Padding + Thickness _padding = ComputePadding(); + Size padding = HelperCollapseThickness(_padding); + if (double.IsNaN(availableSize.Width) || double.IsNaN(availableSize.Height) || double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height)) - availableSize = new Size(100, 100); + availableSize = new Size(Math.Max(0.0, 100 - padding.Width), + Math.Max(0.0, 100 - padding.Height)); + else + availableSize = new Size(Math.Max(0.0, availableSize.Width - padding.Width), + Math.Max(0.0, availableSize.Height - padding.Height)); Fit(desiredRect, availableSize); @@ -290,7 +300,8 @@ protected override Size MeasureOverride(Size availableSize) } centerSize = availCenterSize; - return new Size(availCenterSize.Width + leftRightWidth, availCenterSize.Height + topBottomHeight); + + return new Size(availCenterSize.Width + leftRightWidth + padding.Width, availCenterSize.Height + topBottomHeight + padding.Height); } /// @@ -308,58 +319,64 @@ protected override Size ArrangeOverride(Size finalSize) double x = 0, y = 0; + //Handle Padding + Thickness _padding = ComputePadding(); + Size padding = HelperCollapseThickness(_padding); + //Arranging top elements and setting clip bounds if (topHeight < topHeight2) { + y += _padding.Top; foreach (var elt in topElts) { double finalHeight = elt.DesiredSize.Height * topHeight / topHeight2; - elt.Arrange(new Rect(leftWidth, y, centerSize.Width, finalHeight)); - elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, finalHeight) }; + elt.Arrange(new Rect(leftWidth + _padding.Left, y, centerSize.Width, finalHeight)); + elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth - _padding.Left, 0, finalSize.Width, finalHeight) }; y += finalHeight; } } else { - double iy = topHeight; + double iy = topHeight + _padding.Top; for (int i = topElts.Length - 1; i > -1; i--) { UIElement elt = topElts[i]; - elt.Arrange(new Rect(leftWidth, iy - elt.DesiredSize.Height, centerSize.Width, elt.DesiredSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, elt.DesiredSize.Height) }; + elt.Arrange(new Rect(leftWidth + _padding.Left, iy - elt.DesiredSize.Height, centerSize.Width, elt.DesiredSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth - _padding.Left, 0, finalSize.Width, elt.DesiredSize.Height) }; iy -= elt.DesiredSize.Height; } - y = topHeight; + y = topHeight + _padding.Top; } // Arranging left elements and setting clip bounds if (leftWidth < leftWidth2) { + x += _padding.Left; foreach (var elt in leftElts) { double finalWidth = elt.DesiredSize.Width * leftWidth / leftWidth2; - elt.Arrange(new Rect(x, topHeight, finalWidth, centerSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, finalWidth, finalSize.Height) }; + elt.Arrange(new Rect(x, topHeight + _padding.Top, finalWidth, centerSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight - _padding.Top, finalWidth, finalSize.Height) }; x += finalWidth; } } else { - double ix = leftWidth; + double ix = leftWidth + _padding.Left; for (int i = leftElts.Length - 1; i > -1; i--) { UIElement elt = leftElts[i]; - elt.Arrange(new Rect(ix - elt.DesiredSize.Width, topHeight, elt.DesiredSize.Width, centerSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, elt.DesiredSize.Width, finalSize.Height) }; + elt.Arrange(new Rect(ix - elt.DesiredSize.Width, topHeight + _padding.Top, elt.DesiredSize.Width, centerSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight - _padding.Top, elt.DesiredSize.Width, finalSize.Height) }; ix -= elt.DesiredSize.Width; } - x = leftWidth; + x = leftWidth + _padding.Left; } // Arranging center elements foreach (var elt in centerElts) { - elt.Arrange(new Rect(leftWidth, topHeight, centerSize.Width, centerSize.Height)); + elt.Arrange(new Rect(leftWidth + _padding.Left, topHeight + _padding.Top, centerSize.Width, centerSize.Height)); } x += centerSize.Width; @@ -371,20 +388,22 @@ protected override Size ArrangeOverride(Size finalSize) foreach (var elt in bottomElts) { double finalHeight = elt.DesiredSize.Height * bottomHeight / bottomHeight2; - elt.Arrange(new Rect(leftWidth, y, centerSize.Width, finalHeight)); - elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, finalHeight) }; + elt.Arrange(new Rect(leftWidth + _padding.Left, y, centerSize.Width, finalHeight)); + elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth - _padding.Left, 0, finalSize.Width, finalHeight) }; y += finalHeight; } + y += _padding.Bottom; } else { for (int i = bottomElts.Length - 1; i > -1; i--) { UIElement elt = bottomElts[i]; - elt.Arrange(new Rect(leftWidth, y, centerSize.Width, elt.DesiredSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth, 0, finalSize.Width, elt.DesiredSize.Height) }; + elt.Arrange(new Rect(leftWidth + _padding.Left, y, centerSize.Width, elt.DesiredSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(-leftWidth - _padding.Left, 0, finalSize.Width, elt.DesiredSize.Height) }; y += elt.DesiredSize.Height; } + y += _padding.Bottom; } // Arranging right elements and setting clip bounds @@ -393,20 +412,22 @@ protected override Size ArrangeOverride(Size finalSize) foreach (var elt in rightElts) { double finalWidth = elt.DesiredSize.Width * rightWidth / rightWidth2; - elt.Arrange(new Rect(x, topHeight, finalWidth, centerSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, finalWidth, finalSize.Height) }; + elt.Arrange(new Rect(x, topHeight + _padding.Top, finalWidth, centerSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight - _padding.Top, finalWidth, finalSize.Height) }; x += finalWidth; } + x += _padding.Right; } else { for (int i = rightElts.Length - 1; i > -1; i--) { UIElement elt = rightElts[i]; - elt.Arrange(new Rect(x, topHeight, elt.DesiredSize.Width, centerSize.Height)); - elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight, elt.DesiredSize.Width, finalSize.Height) }; + elt.Arrange(new Rect(x, topHeight + _padding.Top, elt.DesiredSize.Width, centerSize.Height)); + elt.Clip = new RectangleGeometry { Rect = new Rect(0, -topHeight - _padding.Top, elt.DesiredSize.Width, finalSize.Height) }; x += elt.DesiredSize.Width; } + x += _padding.Right; } return new Size(x, y); diff --git a/src/Themes/Generic.xaml b/src/Themes/Generic.xaml index 53f28ed..830917b 100644 --- a/src/Themes/Generic.xaml +++ b/src/Themes/Generic.xaml @@ -41,7 +41,8 @@ IsAutoFitEnabled="{Binding IsAutoFitEnabled, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" AspectRatio="{Binding AspectRatio, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ExtraPadding="{TemplateBinding BorderThickness}" - Background="{TemplateBinding Background}"> + Background="{TemplateBinding Background}" + Padding="{TemplateBinding Padding}"> @@ -53,7 +54,7 @@ VerticalAlignment="Center" IsTabStop="False"/> From a5cb34ca20701cf92eea85420ba747a3eb18b137 Mon Sep 17 00:00:00 2001 From: Windmill-City <1449182174@qq.com> Date: Sun, 2 Feb 2020 13:34:43 +0800 Subject: [PATCH 3/4] Add FigureContent Prop to d3:Chart --- src/InteractiveDataDisplay.WPF.csproj | 2 +- src/Themes/Generic.xaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InteractiveDataDisplay.WPF.csproj b/src/InteractiveDataDisplay.WPF.csproj index 6cfb718..eff1624 100644 --- a/src/InteractiveDataDisplay.WPF.csproj +++ b/src/InteractiveDataDisplay.WPF.csproj @@ -34,7 +34,7 @@ $(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets - 1.1.1 + 1.1.2 Microsoft; MSU ITIS Lab Sergey Berezin, Vassily Lyutsarev, Nikita Skoblov, Natalia Stepanova Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. diff --git a/src/Themes/Generic.xaml b/src/Themes/Generic.xaml index 830917b..44d4f5d 100644 --- a/src/Themes/Generic.xaml +++ b/src/Themes/Generic.xaml @@ -88,7 +88,7 @@ Foreground="{TemplateBinding Foreground}"> - + Date: Sun, 2 Feb 2020 13:52:03 +0800 Subject: [PATCH 4/4] Revert "Add FigureContent Prop to d3:Chart" This reverts commit a5cb34ca20701cf92eea85420ba747a3eb18b137. --- src/InteractiveDataDisplay.WPF.csproj | 2 +- src/Themes/Generic.xaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/InteractiveDataDisplay.WPF.csproj b/src/InteractiveDataDisplay.WPF.csproj index eff1624..6cfb718 100644 --- a/src/InteractiveDataDisplay.WPF.csproj +++ b/src/InteractiveDataDisplay.WPF.csproj @@ -34,7 +34,7 @@ $(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets - 1.1.2 + 1.1.1 Microsoft; MSU ITIS Lab Sergey Berezin, Vassily Lyutsarev, Nikita Skoblov, Natalia Stepanova Interactive Data Display for WPF is a set of controls for adding interactive visualization of dynamic data to your application. diff --git a/src/Themes/Generic.xaml b/src/Themes/Generic.xaml index 44d4f5d..830917b 100644 --- a/src/Themes/Generic.xaml +++ b/src/Themes/Generic.xaml @@ -88,7 +88,7 @@ Foreground="{TemplateBinding Foreground}"> - +