-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jogging speed and distance selectors replaced with Non linear sliders
- Loading branch information
1 parent
a66c320
commit 8c23414
Showing
11 changed files
with
215 additions
and
65 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace grbl.Master.UI.Converters | ||
{ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Media; | ||
|
||
public class NonLinearDouble : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (parameter != null && parameter is Label powLbl && powLbl.Content is double pow) | ||
{ | ||
pow = pow < 1 ? 1 : pow; | ||
if (value != null) | ||
{ | ||
if (value is double val) | ||
{ | ||
return Math.Pow(val, 1d / pow); | ||
} | ||
|
||
if (value is ObservableCollection<double> vals && vals.Any()) | ||
{ | ||
return new DoubleCollection(vals.Select(val => Math.Pow(val, 1d / pow))); | ||
} | ||
} | ||
} | ||
|
||
return 0d; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value != null && value is double val && parameter != null && parameter is Label powLbl && powLbl.Content is double pow) | ||
{ | ||
return Math.Round(Math.Pow(val, pow), 3); | ||
} | ||
return 0d; | ||
} | ||
} | ||
} |
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.