Add reset button to settings flyout (#1073)
This commit is contained in:
parent
e8d03eafc1
commit
4f8db42855
@ -71,6 +71,26 @@ void GraphingSettingsViewModel::InitRanges()
|
|||||||
m_dontUpdateDisplayRange = false;
|
m_dontUpdateDisplayRange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphingSettingsViewModel::ResetView()
|
||||||
|
{
|
||||||
|
if (m_Graph != nullptr)
|
||||||
|
{
|
||||||
|
m_Graph->ResetGrid();
|
||||||
|
InitRanges();
|
||||||
|
m_XMinError = false;
|
||||||
|
m_XMaxError = false;
|
||||||
|
m_YMinError = false;
|
||||||
|
m_YMaxError = false;
|
||||||
|
|
||||||
|
RaisePropertyChanged("XError");
|
||||||
|
RaisePropertyChanged("XMin");
|
||||||
|
RaisePropertyChanged("XMax");
|
||||||
|
RaisePropertyChanged("YError");
|
||||||
|
RaisePropertyChanged("YMin");
|
||||||
|
RaisePropertyChanged("YMax");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphingSettingsViewModel::UpdateDisplayRange()
|
void GraphingSettingsViewModel::UpdateDisplayRange()
|
||||||
{
|
{
|
||||||
if (m_Graph == nullptr || m_dontUpdateDisplayRange || HasError())
|
if (m_Graph == nullptr || m_dontUpdateDisplayRange || HasError())
|
||||||
|
@ -275,6 +275,7 @@ namespace CalculatorApp::ViewModel
|
|||||||
public:
|
public:
|
||||||
void SetGrapher(GraphControl::Grapher ^ grapher);
|
void SetGrapher(GraphControl::Grapher ^ grapher);
|
||||||
void InitRanges();
|
void InitRanges();
|
||||||
|
void ResetView();
|
||||||
bool HasError();
|
bool HasError();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -4226,6 +4226,10 @@
|
|||||||
<value>Units</value>
|
<value>Units</value>
|
||||||
<comment>Heading for Unit's on the settings</comment>
|
<comment>Heading for Unit's on the settings</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ResetViewButton.Content" xml:space="preserve">
|
||||||
|
<value>Reset view</value>
|
||||||
|
<comment>Hyperlink button to reset the view of the graph</comment>
|
||||||
|
</data>
|
||||||
<data name="GraphSettingsXMax.Header" xml:space="preserve">
|
<data name="GraphSettingsXMax.Header" xml:space="preserve">
|
||||||
<value>X-Max</value>
|
<value>X-Max</value>
|
||||||
<comment>X maximum value header</comment>
|
<comment>X maximum value header</comment>
|
||||||
|
@ -102,11 +102,19 @@
|
|||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontWeight="Medium"
|
FontWeight="Medium"
|
||||||
AutomationProperties.HeadingLevel="Level1"/>
|
AutomationProperties.HeadingLevel="Level1"/>
|
||||||
<TextBlock x:Name="GridHeading"
|
<Grid Margin="0,12,0,0">
|
||||||
x:Uid="GridHeading"
|
<Grid.ColumnDefinitions>
|
||||||
Margin="0,12,0,6"
|
<ColumnDefinition Width="*"/>
|
||||||
Style="{StaticResource SubTitleTextBoxStyle}"
|
<ColumnDefinition Width="Auto"/>
|
||||||
AutomationProperties.HeadingLevel="Level2"/>
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock x:Name="GridHeading"
|
||||||
|
x:Uid="GridHeading"
|
||||||
|
Style="{StaticResource SubTitleTextBoxStyle}"
|
||||||
|
AutomationProperties.HeadingLevel="Level2"/>
|
||||||
|
<HyperlinkButton x:Uid="ResetViewButton"
|
||||||
|
Grid.Column="1"
|
||||||
|
Click="ResetViewButton_Clicked"/>
|
||||||
|
</Grid>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
|
@ -61,3 +61,8 @@ void GraphingSettings::RefreshRanges()
|
|||||||
{
|
{
|
||||||
ViewModel->InitRanges();
|
ViewModel->InitRanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphingSettings::ResetViewButton_Clicked(Object ^ sender, RoutedEventArgs ^ e)
|
||||||
|
{
|
||||||
|
ViewModel->ResetView();
|
||||||
|
}
|
||||||
|
@ -23,5 +23,6 @@ namespace CalculatorApp
|
|||||||
void RefreshRanges();
|
void RefreshRanges();
|
||||||
private:
|
private:
|
||||||
void GridSettingsTextBox_PreviewKeyDown(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
|
void GridSettingsTextBox_PreviewKeyDown(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
|
||||||
|
void ResetViewButton_Clicked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user