-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DYN-4964-WorkingRange-Popup (#13656)
* DYN-4964-WorkingRange-Popup I've added a new button in the Workspace that when is clicked will show a popup containing the working ranges and the one currently selected. This new button will show a different image when the mouse is hover and when is clicked, also I've added a tooltip. For implementing this functionality I've added a new Popup (GeometryScalingPopup.xaml) and it's corresponding ViewModel. Finally I've added a converter that will receive as a parameter the current Working Range and will return a Brush with a specific color so the checkmark will be visible or not. * DYN-4964-WorkingRange-Popup CodeReview1 Added functionality for the new DefaultGeometryScaling property that will be serialized in the DynamoSettings.xml. Also I've disconnected the functionality of selecting the Geometry Scale for the current Workspace in the Preferences panel, now will be selected from the Dynamo workspace and will be serialized in the dyn file (as currently is happening). * DYN-4964-WorkingRange-Popup CodeReview1 Updated the string shown in Preferences panel (Geometry Scaling section) and the tooltip showed when the mouse is over the new Workspace button. * Build Fix When merging master to my branch there were some changed that I didn't noticed in the PR so I'm reverting back those changes. * DYN-4964-WorkingRange-Popup CodeReview 2 Fixed several comments also several methods were removed (like RadioGeometryScaling_Checked method) or moved The property GeoScalingViewModel was moved from DynamoViewModel to WorkspaceViewModel.. The property CurrentGeometryScaling was deleted due that was duplicating a functionality. * DYN-4964-WorkingRange-Popup CodeReview 2 When changing the Workspace Geometry Scaling it was not running the graph so I did some changes so it will be running the graph every time is updated. * DYN-4964-WorkingRange-Popup CodeReview 2 Add functionality for when a custom node is created the Workspace Scale Factor is set. Updating and removing some comments and also I started to add the unit test. * DYN-4964-WorkingRange-Popup CodeReview2 Updating Unit Test * DYN-4964-WorkingRange-Popup Fixing Tests I did the next fixes: The test TestImportCopySettings() was failing due that was reading the DynamoSettings-NewSettings.xml and comparing against the properties in PreferencesSetting so the DefaultScaleFactor was missing in the DynamoSettings-NewSettings.xml file. The test PreferencesGeoScaling_RunGraph_Automatic due that was opening the Preferences panel and changing the Geometry Scaling value for the workspace but now that this value was moved to the Workspace in a Popup then the code needed some changes so we can change the Geometry Scaling value using the Popup.
- Loading branch information
1 parent
7262a78
commit 58c4470
Showing
22 changed files
with
568 additions
and
142 deletions.
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
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
Binary file added
BIN
+1.63 KB
src/DynamoCoreWpf/UI/Images/Canvas/canvas-button-geometry-scaling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
80 changes: 80 additions & 0 deletions
80
src/DynamoCoreWpf/ViewModels/Core/GeometryScalingViewModel.cs
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Dynamo.Core; | ||
using Dynamo.ViewModels; | ||
|
||
namespace ViewModels.Core | ||
{ | ||
/// <summary> | ||
/// This class will be contain information about the current Geometry Scale selected in the Dynamo Workspace | ||
/// </summary> | ||
public class GeometryScalingViewModel : NotificationObject | ||
{ | ||
private DynamoViewModel dynViewModel; | ||
private GeometryScaleSize scaleSize; | ||
private double scaleValue = 0; | ||
internal double ScaleValue | ||
{ | ||
get | ||
{ | ||
return scaleValue; | ||
} | ||
set | ||
{ | ||
scaleValue = value; | ||
UpdateGeometryScale(scaleValue); | ||
} | ||
} | ||
|
||
internal GeometryScalingViewModel(DynamoViewModel dynViewModel) | ||
{ | ||
this.dynViewModel = dynViewModel; | ||
} | ||
|
||
internal Tuple<string, string, string> ScaleRange | ||
{ | ||
get | ||
{ | ||
return scaleRanges[ScaleSize]; | ||
} | ||
} | ||
|
||
|
||
internal static Dictionary<GeometryScaleSize, Tuple<string, string, string>> scaleRanges = new Dictionary<GeometryScaleSize, Tuple<string, string, string>> | ||
{ | ||
{GeometryScaleSize.Medium, new Tuple<string, string, string>("medium", "0.0001", "10,000")}, | ||
{GeometryScaleSize.Small, new Tuple<string, string, string>("small", "0.000,001", "100")}, | ||
{GeometryScaleSize.Large, new Tuple<string, string, string>("large", "0.01", "1,000,000")}, | ||
{GeometryScaleSize.ExtraLarge, new Tuple<string, string, string>("extra large", "1", "100,000,000")} | ||
}; | ||
|
||
/// <summary> | ||
/// Current Geometry Scale selected in dynamo workspace. | ||
/// </summary> | ||
public GeometryScaleSize ScaleSize | ||
{ | ||
get | ||
{ | ||
return scaleSize; | ||
} | ||
set | ||
{ | ||
if(scaleSize != value) | ||
{ | ||
scaleSize = value; | ||
RaisePropertyChanged(nameof(ScaleSize)); | ||
} | ||
} | ||
} | ||
|
||
internal void UpdateGeometryScale(double scaleFactor) | ||
{ | ||
int UIScaleFactor = GeometryScalingOptions.ConvertScaleFactorToUI((int)scaleFactor); | ||
|
||
if (Enum.IsDefined(typeof(GeometryScaleSize), UIScaleFactor)) | ||
{ | ||
ScaleSize = (GeometryScaleSize)UIScaleFactor; | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.