Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved zoom and navigation performance for large graphs with many nodes #15730

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ public object Convert(object value, Type targetType, object parameter, System.Gl
{
if (value is int zero)
{
return zero == 0 ? Visibility.Collapsed : Visibility.Visible;
return zero == 0 ? Visibility.Collapsed : Visibility.Visible;
}

return Visibility.Collapsed; // If not int or int not zero, return collapsed.
Expand Down Expand Up @@ -1844,7 +1844,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
throw new NotSupportedException();
}
}

public class ZoomToOpacityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand Down Expand Up @@ -1875,7 +1875,7 @@ public object Convert(object value, Type targetType, object parameter, System.Gl
if (number > Configurations.ZoomThreshold)
return Visibility.Collapsed;

return Visibility.Visible;
return Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand All @@ -1884,6 +1884,31 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

public class BooleanStyleConverter : IValueConverter
{
public Style TrueStyle { get; set; }
public Style FalseStyle { get; set; }

//public static readonly DependencyProperty TestValueProperty = DependencyProperty
// .Register(nameof(TestValue), typeof(bool), typeof(BooleanStyleConverter));

//public bool TestValue { get => (bool)GetValue(TestValueProperty); set => SetValue(TestValueProperty, value); }

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool v && v)
{
return TrueStyle;
}
return FalseStyle;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return false;
}
}

public class PortNameToWidthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand Down Expand Up @@ -2201,7 +2226,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
if (values != null && values.Count() > 0)
{
if (!string.IsNullOrEmpty((string)values[0]) || !string.IsNullOrEmpty((string)values[1]))
return Visibility.Visible; ;
return Visibility.Visible; ;
}
return Visibility.Collapsed;
}
Expand Down Expand Up @@ -2798,7 +2823,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn

catch (Exception e)
{
Console.WriteLine($"problem attempting to parse fontsize or param {value} {parameter} { e.Message}");
Console.WriteLine($"problem attempting to parse fontsize or param {value} {parameter} {e.Message}");
return false;
}

Expand Down Expand Up @@ -2877,7 +2902,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
//just use defaults, this will enable the text editor.
catch (Exception e)
{
Console.WriteLine($"problem attempting to parse fontsize or zoom {values[1]} {values[0]}. { e.Message}");
Console.WriteLine($"problem attempting to parse fontsize or zoom {values[1]} {values[0]}. {e.Message}");
}

var factor = zoom * fontsize;
Expand Down Expand Up @@ -3553,7 +3578,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
{
throw new NotImplementedException();
}
}
}

/// <summary>
/// Converts the object type to forground color for the object.
Expand All @@ -3579,7 +3604,7 @@ public object Convert(object[] values, Type targetType, object parameter, System
case nameof(TypeCode.String):
return resourceDictionary["stringLabelBackground"] as SolidColorBrush;
case nameof(TypeCode.Boolean):
return resourceDictionary["boolLabelBackground"] as SolidColorBrush;
return resourceDictionary["boolLabelBackground"] as SolidColorBrush;
default:
if (values[1].ToString() == "List")
{
Expand All @@ -3596,7 +3621,7 @@ public object Convert(object[] values, Type targetType, object parameter, System
return resourceDictionary["PrimaryCharcoal200Brush"] as SolidColorBrush;
}
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
Expand Down Expand Up @@ -3649,9 +3674,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
if (value.Equals(parameter))
{
return new SolidColorBrush(Color.FromRgb(217, 217, 217));
}
}
return new SolidColorBrush(Color.FromRgb(71, 71, 71));

}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down Expand Up @@ -4015,7 +4040,7 @@ public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is string nullOrEmptyString && String.IsNullOrEmpty(nullOrEmptyString)) return Visibility.Visible;

return Visibility.Collapsed;
}

Expand Down
Loading
Loading