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

[23Q1T1] Fade-out Node Glyphs #12664

Merged
merged 12 commits into from
Mar 23, 2022
17 changes: 14 additions & 3 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<EnableDefaultEmbeddedResourceItems>False</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>
<ItemGroup>
<None Remove="UI\Images\NodeStates\alert-64px.png" />
<None Remove="UI\Images\NodeStates\error-64px.png" />
<None Remove="UI\Images\NodeStates\frozen-64px.png" />
<None Remove="UI\Images\NodeStates\hidden-64px.png" />
<None Remove="UI\Images\NodeStates\info-64px.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.LibG_228_0_0" Version="2.13.0.7686" />
<PackageReference Include="Greg" Version="2.1.8012.31283" />
<PackageReference Include="Newtonsoft.Json" Version="8.0.3" />
<PackageReference Include="RestSharp" Version="106.12.0" />
<PackageReference Include="FontAwesome.WPF" Version="4.7.0.9" CopyXML="true"/>
<PackageReference Include="FontAwesome.WPF" Version="4.7.0.9" CopyXML="true" />
<PackageReference Include="Cyotek.Drawing.BitmapFont" Version="2.0.0" />
<PackageReference Include="HelixToolkit" Version="2.17.0" />
<PackageReference Include="HelixToolkit.Wpf" Version="2.17.0" />
<PackageReference Include="HelixToolkit.Wpf.SharpDX" Version="2.17.0" />
<PackageReference Include="SharpDX" Version="4.2.0" />
<PackageReference Include="SharpDX.D3DCompiler" Version="4.2.0" >
<PackageReference Include="SharpDX.D3DCompiler" Version="4.2.0">
<IncludeAssets>none</IncludeAssets>
</PackageReference>
<PackageReference Include="SharpDX.Direct2D1" Version="4.2.0">
Expand Down Expand Up @@ -741,6 +748,11 @@
</ItemGroup>
<ItemGroup>
<Resource Include="UI\Images\closetab_normal.png" />
<Resource Include="UI\Images\NodeStates\alert-64px.png" />
<Resource Include="UI\Images\NodeStates\error-64px.png" />
<Resource Include="UI\Images\NodeStates\frozen-64px.png" />
<Resource Include="UI\Images\NodeStates\hidden-64px.png" />
<Resource Include="UI\Images\NodeStates\info-64px.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="UI\Images\whiteclosetab.png" />
Expand Down Expand Up @@ -1479,7 +1491,6 @@
<Resource Include="UI\Images\icon-whats-new-small.png" />
<Resource Include="UI\Images\icon-dictionary-small.png" />
</ItemGroup>
<ItemGroup />
<Target Name="AfterBuildOps" AfterTargets="Build">
<MakeDir Directories="$(OutputPath)\viewExtensions\" />
</Target>
Expand Down
84 changes: 83 additions & 1 deletion src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,11 +1283,54 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

/// <summary>
/// Evaluates if the value is null and converts it to Visible or Collapsed state
/// </summary>
public class EmptyToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
return Visibility.Visible;
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

/// <summary>
/// Takes a value and if the value is not null returns Unity Type Auto (*) as a length value
/// Returns 0 length if the value is null
/// To be used in Grid Column/Row width
/// </summary>
public class EmptyToZeroLengthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
return new GridLength(1, GridUnitType.Auto);
}
else
{
return new GridLength(0);
}
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

/// <summary>
/// Used in the Dynamo package manager search window to hide or show a label next to each package's name.
/// The label only appears if the package has been recently created/updated (in the last 30 days).
/// Label text is set via the DateToPackageLabelConverter.
/// </summary>
/// </summary>
public class DateToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand Down Expand Up @@ -1562,6 +1605,45 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

public class ZoomToOpacityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double number = (double)System.Convert.ChangeType(value, typeof(double));

if (number <= 0.4)
return 0.0;

return 0.5;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

/// <summary>
/// Hides (collapses) if the zoom level is larger than the designated value
/// </summary>
public class ZoomToVisibilityCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double number = (double)System.Convert.ChangeType(value, typeof(double));

if (number > 0.4)
return Visibility.Collapsed;

return Visibility.Visible;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

public class PortNameToWidthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/NodeStates/error-64px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/NodeStates/hidden-64px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@
<controls:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<controls:BoolToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<controls:InverseBooleanToVisibilityCollapsedConverter x:Key="InverseBoolToVisibilityCollapsedConverter" />
<controls:EmptyToVisibilityCollapsedConverter x:Key="EmptyToVisibilityCollapsedConverter"/>
<controls:EmptyToZeroLengthConverter x:Key="EmptyToZeroLengthConverter"/>
<controls:NavigationToOpacityConverter x:Key="NavigationToOpacityConverter" />
<controls:ViewButtonClipRectConverter x:Key="ViewButtonClipRectConverter" />
<controls:ZoomToVisibilityConverter x:Key="ZoomToVisibilityConverter" />
<controls:ZoomToOpacityConverter x:Key="ZoomToOpacityConverter" />
<controls:ZoomToBooleanConverter x:Key="ZoomToBooleanConverter" />
<controls:ZoomToVisibilityCollapsedConverter x:Key="ZoomToVisibilityCollapsedConverter" />
<controls:PortNameToWidthConverter x:Key="PortNameToWidthConverter" />
<controls:TooltipLengthTruncater x:Key="TooltipLengthTruncater" />
<controls:TabSizeConverter x:Key="TabSizeConverter" />
Expand Down
104 changes: 104 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,110 @@
</Style.Triggers>
</Style>

<!-- Zoom fade-in preview -->
<Style x:Key="SZoomFadeInPreview" TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.Zoom, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:WorkspaceView}}, Converter={StaticResource ZoomToBooleanConverter}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.0"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.5"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>

<!-- Zoom fade-in preview -->
<Style x:Key="SZoomFadeOutPreview" TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.Zoom, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:WorkspaceView}}, Converter={StaticResource ZoomToBooleanConverter}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.5"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.0"
Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>

<!-- Zoom fade-out framework element -->
<Style x:Key="SZoomFadeOutFrameworkElement" TargetType="{x:Type FrameworkElement}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.Zoom, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:WorkspaceView}}, Converter={StaticResource ZoomToBooleanConverter}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="1.0"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.0"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>

<!-- Zoom fade-in framework element -->
<Style x:Key="SZoomFadeInFrameworkElement" TargetType="{x:Type FrameworkElement}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.Zoom, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:WorkspaceView}}, Converter={StaticResource ZoomToBooleanConverter}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.0"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="1.0"
Duration="0:0:0.2" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>

<Style x:Key="TextButtonStyle" TargetType="Button">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Cursor" Value="Hand" />
Expand Down
Loading