-
Notifications
You must be signed in to change notification settings - Fork 638
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
Merged
QilongTang
merged 15 commits into
DynamoDS:master
from
filipeotero:DYN-5530-Library-Zoom-Scaling
Feb 16, 2023
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a639208
PreferencesView slider
filipeotero e7ce48b
Slider style
filipeotero ae4932f
change zoom scale with the slider
filipeotero 987150f
Saving zoom scale value in the preference settings
filipeotero 3a355c7
removing wrong line
filipeotero 7f01de1
removing extra instances
filipeotero a9098a0
fix unit tests
filipeotero 89f0adb
adding 200% label
filipeotero f324523
removing extra spaces
filipeotero dc1a137
minor code changes
filipeotero 5c68995
Merge branch 'master' into DYN-5530-Library-Zoom-Scaling
filipeotero 06b41da
minor changes
filipeotero f24e566
Adding resource and adjust bar size related to the slider value
filipeotero d34736b
Merge branch 'master' into DYN-5530-Library-Zoom-Scaling
filipeotero 700cd7e
retrigger checks
filipeotero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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; | ||
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 +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); | ||
} | ||
|
||
/// <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 +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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.