Theme.Static.xaml (without compile, no perfomance difference with dynamic). +ThemeManager improvements.

This commit is contained in:
2017-08-31 15:55:40 +03:00
parent 9c2dc48ee2
commit 284cb40004
28 changed files with 6322 additions and 458 deletions

View File

@@ -58,23 +58,10 @@ namespace BrightSharp.Diagrams
var zoomChangedHandler = new RoutedEventHandler((sender, args) =>
{
var lodInfo = new LodInfo(GetLODZoom(element));
var transform = element.TransformToVisual(window) as MatrixTransform;
var scaleX = transform.Matrix.M11;
var newOpacity = (scaleX >= lodInfo.StartRange && scaleX <= lodInfo.EndRange) ? 1 : 0;
if (lodInfo.UseAnimation && args.RoutedEvent != FrameworkElement.LoadedEvent)
{
element.Visibility = Visibility.Visible;
var animation = new DoubleAnimation(newOpacity, TimeSpan.FromSeconds(.5));
element.BeginAnimation(UIElement.OpacityProperty, animation);
try {
ChangeVisibility(args, element, window);
}
else
{
element.Visibility = newOpacity == 1 ? Visibility.Visible : Visibility.Hidden;
element.Opacity = newOpacity;
catch (Exception) {
}
});
@@ -93,6 +80,25 @@ namespace BrightSharp.Diagrams
}
}
private static void ChangeVisibility(RoutedEventArgs args, FrameworkElement element, Window window) {
var lodInfo = new LodInfo(GetLODZoom(element));
var transform = element.TransformToVisual(window) as MatrixTransform;
var scaleX = transform.Matrix.M11;
var newOpacity = (scaleX >= lodInfo.StartRange && scaleX <= lodInfo.EndRange) ? 1 : 0;
if (lodInfo.UseAnimation && args.RoutedEvent != FrameworkElement.LoadedEvent) {
element.Visibility = Visibility.Visible;
var animation = new DoubleAnimation(newOpacity, TimeSpan.FromSeconds(.5));
element.BeginAnimation(UIElement.OpacityProperty, animation);
}
else {
element.Visibility = newOpacity == 1 ? Visibility.Visible : Visibility.Hidden;
element.Opacity = newOpacity;
}
}
sealed class LodInfo
{
public LodInfo(string lod)