Fix some UI bugs in graph mode (#862)

* Address issues with error states

* Add various fixes

* Add back initial tooltip

* PR comments
This commit is contained in:
Pepe Rivera
2019-12-12 12:58:28 -08:00
committed by GitHub
parent f282605bc6
commit 2a0637e51c
9 changed files with 58 additions and 25 deletions

View File

@@ -650,6 +650,7 @@
<!-- Ideally the KeyGraphFeaturesPanel should be a frame so that navigation to and from the panel could be handled nicely -->
<local:KeyGraphFeaturesPanel x:Name="KeyGraphFeaturesControl"
Grid.RowSpan="2"
Margin="0,4,0,0"
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
ViewModel="{x:Bind EquationInputAreaControl.EquationVM, Mode=OneWay}"
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"

View File

@@ -151,7 +151,12 @@ void GraphingCalculator::OnEquationsVectorChanged(IObservableVector<EquationView
void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint)
{
TraceValue->Text = "(" + newPoint.X.ToString() + ", " + newPoint.Y.ToString() + ")";
wstringstream traceValueString;
// TODO: The below precision should ideally be dynamic based on the current scale of the graph.
traceValueString << "x=" << fixed << setprecision(1) << newPoint.X << ", y=" << fixed << setprecision(1) << newPoint.Y;
TraceValue->Text = ref new String(traceValueString.str().c_str());
auto peer = FrameworkElementAutomationPeer::FromElement(TraceValue);
@@ -507,6 +512,8 @@ void GraphingCalculator::TraceValuePopup_SizeChanged(Object ^ sender, SizeChange
void CalculatorApp::GraphingCalculator::ActiveTracing_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
{
GraphingControl->Focus(::FocusState::Programmatic);
m_activeTracingKeyUpToken = Window::Current->CoreWindow->KeyUp +=
ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow ^, Windows::UI::Core::KeyEventArgs ^>(
this, &CalculatorApp::GraphingCalculator::ActiveTracing_KeyUp);

View File

@@ -25,7 +25,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:EquationTextBox">
<Grid>
<Grid Background="{ThemeResource TextControlBackground}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -102,7 +102,7 @@
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="IsEnabled" Value="True"/>
<Setter Property="Margin" Value="-8,0,0,0"/>
<Setter Property="Padding" Value="0,3,4,0"/>
<Setter Property="UseSystemFocusVisuals" Value="True"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
@@ -169,8 +169,8 @@
<Border x:Name="BorderElement"
Grid.Row="1"
Grid.RowSpan="1"
MinWidth="{ThemeResource TextControlThemeMinWidth}"
MinHeight="{ThemeResource TextControlThemeMinHeight}"
MinWidth="0"
MinHeight="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
@@ -224,6 +224,7 @@
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="IsTextSelectionEnabled" Value="True"/>
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
</Style>
@@ -243,6 +244,11 @@
Style="{StaticResource KGF_TitleTextBlockStyle}"
Text="{x:Bind Title, Mode=OneWay}"/>
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Margin" Value="0"/>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="x:String">
<controls:MathRichEditBox HorizontalAlignment="Left"
@@ -265,7 +271,7 @@
<DataTemplate x:DataType="vm:GridDisplayItems">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto" MinWidth="64"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:MathRichEditBox Grid.Column="0"
@@ -308,7 +314,7 @@
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
</UserControl.Resources>
<Grid Margin="0,7,0,0" Background="Transparent">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
@@ -335,8 +341,7 @@
<ListView x:Name="KeyGraphFeaturesListView"
Grid.Row="2"
Margin="12,10,10,0"
Padding="0,0,0,12"
Padding="12,10,10,12"
IsItemClickEnabled="False"
ItemContainerStyle="{StaticResource KGF_ListViewItemContainerStyle}"
ItemTemplateSelector="{StaticResource KGFTemplateSelector}"
@@ -350,6 +355,7 @@
Margin="12,10,10,0"
Style="{StaticResource KGF_TextBlockStyle}"
FontWeight="Normal"
IsTextSelectionEnabled="False"
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
</Grid>