diff --git a/src/DynamoCore/Configuration/PreferenceSettings.cs b/src/DynamoCore/Configuration/PreferenceSettings.cs index edd683d0fa1..e4923adb2cf 100644 --- a/src/DynamoCore/Configuration/PreferenceSettings.cs +++ b/src/DynamoCore/Configuration/PreferenceSettings.cs @@ -166,6 +166,11 @@ public bool IsADPAnalyticsReportingApproved /// public bool ShowConnectorToolTip { get; set; } + /// + /// Indicates the zoom scale of the library + /// + public float LibraryZoomScale { get; set; } + /// /// The types of connector: Bezier or Polyline. /// @@ -777,6 +782,8 @@ public PreferenceSettings() BackupFilesCount = 1; BackupFiles = new List(); + LibraryZoomScale = 1; + CustomPackageFolders = new List(); PythonTemplateFilePath = ""; diff --git a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs index bd454d23d1b..607a7b026e0 100644 --- a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs +++ b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -46,6 +46,7 @@ [assembly: InternalsVisibleTo("GraphMetadataViewExtension")] [assembly: InternalsVisibleTo("PackageDetailsViewExtension")] [assembly: InternalsVisibleTo("Notifications")] +[assembly: InternalsVisibleTo("LibraryViewExtensionWebView2")] [assembly: InternalsVisibleTo("IronPythonTests")] [assembly: InternalsVisibleTo("DynamoPackagesWPF")] [assembly: InternalsVisibleTo("DynamoPlayerExtension")] @@ -56,4 +57,4 @@ [assembly: TypeForwardedTo(typeof(Dynamo.Wpf.Interfaces.LayoutElement))] [assembly: TypeForwardedTo(typeof(Dynamo.Wpf.Interfaces.LayoutElementType))] [assembly: TypeForwardedTo(typeof(Dynamo.Wpf.Interfaces.LayoutIncludeInfo))] -[assembly: TypeForwardedTo(typeof(Dynamo.Wpf.Interfaces.ILibraryViewCustomization))] \ No newline at end of file +[assembly: TypeForwardedTo(typeof(Dynamo.Wpf.Interfaces.ILibraryViewCustomization))] diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index a29f84ca659..80f40399824 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -3902,6 +3902,15 @@ public static string LibraryViewTitle { } } + /// + /// Looks up a localized string similar to Drag to adjust Library zoom scale between 10% and 300%. You can also adjust this in Library by pressing “Shift” and scrolling the mouse wheel.. + /// + public static string LibraryZoomScaleTooltipText { + get { + return ResourceManager.GetString("LibraryZoomScaleTooltipText", resourceCulture); + } + } + /// /// Looks up a localized string similar to Package has conflicts with one or more loaded packages.. /// @@ -6908,6 +6917,15 @@ public static string PreferencesViewVisualSettingsTab { } } + /// + /// Looks up a localized string similar to Zoom Scaling. + /// + public static string PreferencesViewZoomScalingSettings { + get { + return ResourceManager.GetString("PreferencesViewZoomScalingSettings", resourceCulture); + } + } + /// /// Looks up a localized string similar to When toggled on, Dynamo benefits from hardware acceleration to improve smoothness of graphics and overall performance, as work is offloaded from central processing units (CPUs) to graphics processing units (GPUs).. /// diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index f3f205d6880..282182fb000 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -3488,4 +3488,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Preview Geometry + + Drag to adjust Library zoom scale between 10% and 300%. You can also adjust this in Library by pressing “Shift” and scrolling the mouse wheel. + + + Zoom Scaling + \ No newline at end of file diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 259e4d3e0a3..be8c0a38d32 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -3475,4 +3475,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Preview Geometry + + Drag to adjust Library zoom scale between 10% and 300%. You can also adjust this in Library by pressing “Shift” and scrolling the mouse wheel. + + + Zoom Scaling + \ No newline at end of file diff --git a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml index d8c1543db8a..e7c91a61baf 100644 --- a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml +++ b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml @@ -5487,4 +5487,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs index 259511141a0..45de26f3270 100644 --- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs @@ -75,6 +75,7 @@ public partial class DynamoView : Window, IDisposable private int tabSlidingWindowStart, tabSlidingWindowEnd; private readonly LoginService loginService; private ShortcutToolbar shortcutBar; + private PreferencesView preferencesWindow; private bool loaded = false; // This is to identify whether the PerformShutdownSequenceOnViewModel() method has been // called on the view model and the process is not cancelled @@ -98,6 +99,12 @@ public partial class DynamoView : Window, IDisposable internal ShortcutToolbar ShortcutBar { get { return shortcutBar; } } + internal PreferencesView PreferencesWindow { + get { return preferencesWindow; } + } + + internal event Action OnPreferencesWindowChanged; + /// /// Constructor /// @@ -1868,7 +1875,8 @@ private void OnDebugModesClick(object sender, RoutedEventArgs e) private void OnPreferencesWindowClick(object sender, RoutedEventArgs e) { - var preferencesWindow = new PreferencesView(this); + preferencesWindow = new PreferencesView(this); + OnPreferencesWindowChanged(); preferencesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; preferencesWindow.ShowDialog(); } diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml index da16407e064..3200a5e3b0e 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml @@ -919,6 +919,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs index 1d933cebf40..7a54fc03baf 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs @@ -15,6 +15,7 @@ using Dynamo.Exceptions; using Dynamo.Logging; using Dynamo.UI; +using Dynamo.UI.Views; using Dynamo.ViewModels; using Res = Dynamo.Wpf.Properties.Resources; @@ -54,12 +55,12 @@ private void StoreOriginalCustomGroupStyles() /// /// Dynamo ViewModel public PreferencesView(DynamoView dynamoView) - { + { dynViewModel = dynamoView.DataContext as DynamoViewModel; SetupPreferencesViewModel(dynViewModel); DataContext = dynViewModel.PreferencesViewModel; - + InitializeComponent(); Dynamo.Logging.Analytics.TrackEvent( Actions.Open, @@ -81,6 +82,8 @@ public PreferencesView(DynamoView dynamoView) viewModel.InitializeGeometryScaling(); viewModel.RequestShowFileDialog += OnRequestShowFileDialog; + + LibraryZoomScalingSlider.Value = dynViewModel.Model.PreferenceSettings.LibraryZoomScale; } /// diff --git a/src/LibraryViewExtensionWebView2/LibraryViewController.cs b/src/LibraryViewExtensionWebView2/LibraryViewController.cs index d1e48ed60e3..7717bfa0e8e 100644 --- a/src/LibraryViewExtensionWebView2/LibraryViewController.cs +++ b/src/LibraryViewExtensionWebView2/LibraryViewController.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using Dynamo.Controls; using Dynamo.Extensions; using Dynamo.LibraryViewExtensionWebView2.Handlers; using Dynamo.LibraryViewExtensionWebView2.ViewModels; @@ -31,6 +32,7 @@ namespace Dynamo.LibraryViewExtensionWebView2 public class LibraryViewController : IDisposable { private Window dynamoWindow; + private DynamoView dynamoView; private ICommandExecutive commandExecutive; private DynamoViewModel dynamoViewModel; private FloatingLibraryTooltipPopup libraryViewTooltip; @@ -72,6 +74,9 @@ internal LibraryViewController(Window dynamoView, ICommandExecutive commandExecu dynamoWindow.StateChanged += DynamoWindowStateChanged; dynamoWindow.SizeChanged += DynamoWindow_SizeChanged; + this.dynamoView = dynamoView as DynamoView; + this.dynamoView.OnPreferencesWindowChanged += PreferencesWindowChanged; + DirectoryInfo webBrowserUserDataFolder; var userDataDir = new DirectoryInfo(dynamoViewModel.Model.PathManager.UserDataDirectory); webBrowserUserDataFolder = userDataDir.Exists ? userDataDir : null; @@ -81,6 +86,16 @@ internal LibraryViewController(Window dynamoView, ICommandExecutive commandExecu } } + private void Browser_ZoomFactorChanged(object sender, EventArgs e) + { + dynamoViewModel.Model.PreferenceSettings.LibraryZoomScale = ((float)browser.ZoomFactor); + } + + void PreferencesWindowChanged() + { + this.dynamoView.PreferencesWindow.LibraryZoomScalingSlider.ValueChanged += DynamoSliderValueChanged; + } + //if the window is resized toggle visibility of browser to force redraw private void DynamoWindow_SizeChanged(object sender, SizeChangedEventArgs e) { @@ -321,6 +336,9 @@ private void Browser_CoreWebView2InitializationCompleted(object sender, CoreWebV } SetLibraryFontSize(); + + browser.ZoomFactor = dynamoViewModel.Model.PreferenceSettings.LibraryZoomScale; + browser.ZoomFactorChanged += Browser_ZoomFactorChanged; } private void Browser_Loaded(object sender, RoutedEventArgs e) @@ -528,6 +546,13 @@ private void InitializeResourceProviders(DynamoModel model, LibraryViewCustomiza layoutProvider = new LayoutSpecProvider(customization, iconProvider, "Dynamo.LibraryViewExtensionWebView2.web.library.layoutSpecs.json"); } + private void DynamoSliderValueChanged(object sender, EventArgs e) + { + Slider slider = (Slider)sender; + browser.ZoomFactor = slider.Value; + dynamoViewModel.Model.PreferenceSettings.LibraryZoomScale = ((float)slider.Value); + } + /// /// This method will execute the action of moving the Guide to the next Step (it is triggered when a specific html div that contains the package is clicked). /// @@ -567,6 +592,10 @@ protected void Dispose(bool disposing) { dynamoWindow.StateChanged -= DynamoWindowStateChanged; dynamoWindow.SizeChanged -= DynamoWindow_SizeChanged; + browser.ZoomFactorChanged -= Browser_ZoomFactorChanged; + this.dynamoView.PreferencesWindow.LibraryZoomScalingSlider.ValueChanged -= DynamoSliderValueChanged; + this.dynamoView.OnPreferencesWindowChanged -= PreferencesWindowChanged; + dynamoWindow = null; } if (this.browser != null) diff --git a/test/DynamoCoreWpfTests/PackageManagerViewExtensionTests.cs b/test/DynamoCoreWpfTests/PackageManagerViewExtensionTests.cs index 53b8b38f540..9ec62281a10 100644 --- a/test/DynamoCoreWpfTests/PackageManagerViewExtensionTests.cs +++ b/test/DynamoCoreWpfTests/PackageManagerViewExtensionTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.IO; diff --git a/test/settings/DynamoSettings-NewSettings.xml b/test/settings/DynamoSettings-NewSettings.xml index c0e4c36cba8..85ecc24a2ed 100644 --- a/test/settings/DynamoSettings-NewSettings.xml +++ b/test/settings/DynamoSettings-NewSettings.xml @@ -8,6 +8,7 @@ false false false + 2.03 POLYLINE