-
Notifications
You must be signed in to change notification settings - Fork 635
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
Dyn 5530 library zoom scaling #13733
Changes from 10 commits
a639208
e7ce48b
ae4932f
987150f
3a355c7
7f01de1
a9098a0
89f0adb
f324523
dc1a137
5c68995
06b41da
f24e566
d34736b
700cd7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -42,6 +44,8 @@ public class LibraryViewController : IDisposable | |
// TODO remove this when we can control the library state from Dynamo more precisely. | ||
private bool disableObserver = false; | ||
|
||
private static readonly string LibrarSlider = "notificationsButton"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this used? |
||
|
||
private LayoutSpecProvider layoutProvider; | ||
private NodeItemDataProvider nodeProvider; | ||
internal SearchResultDataProvider searchResultDataProvider; | ||
|
@@ -72,6 +76,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 +88,16 @@ internal LibraryViewController(Window dynamoView, ICommandExecutive commandExecu | |
} | ||
} | ||
|
||
private void Browser_ZoomFactorChanged(object sender, EventArgs e) | ||
{ | ||
dynamoViewModel.Model.PreferenceSettings.LibraryZoomScale = browser.ZoomFactor; | ||
} | ||
|
||
void PreferencesWindowChanged() | ||
{ | ||
this.dynamoView.PreferencesWindow.LibraryZoomScalingSlider.ValueChanged += DynamoSliderValueChanged; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a new PreferencesWindow is created, the value of the slider is subscribed. |
||
} | ||
|
||
//if the window is resized toggle visibility of browser to force redraw | ||
private void DynamoWindow_SizeChanged(object sender, SizeChangedEventArgs e) | ||
{ | ||
|
@@ -321,6 +338,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 +548,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 = slider.Value; | ||
} | ||
|
||
/// <summary> | ||
/// 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). | ||
/// </summary> | ||
|
@@ -567,6 +594,12 @@ 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; | ||
|
||
var dynamoViewWindow = dynamoWindow as DynamoView; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this line here? |
||
|
||
dynamoWindow = null; | ||
} | ||
if (this.browser != null) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.CodeDom.Compiler; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
<ShowCodeBlockLineNumber>false</ShowCodeBlockLineNumber> | ||
<ShowConnector>false</ShowConnector> | ||
<ShowConnectorToolTip>false</ShowConnectorToolTip> | ||
<LibraryZoomScale>2.0361751152073739</LibraryZoomScale> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the value intended to be so long? Can we limit the digit length of the value serialized somehow? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use float instead of double There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Works for me |
||
<ConnectorType>POLYLINE</ConnectorType> | ||
<BackgroundPreviews> | ||
<BackgroundPreviewActiveState> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library extension didn't have access to the new PreferencesView object created. So, this event was added to be called after a new preferences window is opened.