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:
parent
f282605bc6
commit
2a0637e51c
@ -1923,9 +1923,9 @@
|
|||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="PointerOverError">
|
<VisualState x:Name="PointerOverError">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="EquationBoxBorder.BorderBrush" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=EquationColor}"/>
|
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource EquationBoxErrorBackgroundBrush}"/>
|
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource EquationBoxErrorBackgroundBrush}"/>
|
||||||
<Setter Target="ColorChooserButton.Visibility" Value="Visible"/>
|
<Setter Target="ColorChooserButton.Visibility" Value="Collapsed"/>
|
||||||
<Setter Target="FunctionButton.Visibility" Value="Collapsed"/>
|
<Setter Target="FunctionButton.Visibility" Value="Collapsed"/>
|
||||||
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
<Setter Target="RemoveButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
||||||
@ -1944,12 +1944,18 @@
|
|||||||
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
|
<VisualState x:Name="FocusedError">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="EquationBoxBorder.BorderBrush" Value="{ThemeResource EquationBoxErrorBorderBrush}"/>
|
||||||
|
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
|
||||||
|
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
<VisualStateGroup x:Name="ButtonStates">
|
<VisualStateGroup x:Name="ButtonStates">
|
||||||
<VisualState x:Name="ButtonVisible">
|
<VisualState x:Name="ButtonVisible">
|
||||||
<VisualState.Setters>
|
<VisualState.Setters>
|
||||||
<Setter Target="DeleteButton.Visibility" Value="Visible"/>
|
<Setter Target="DeleteButton.Visibility" Value="Visible"/>
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Collapsed"/>
|
|
||||||
</VisualState.Setters>
|
</VisualState.Setters>
|
||||||
</VisualState>
|
</VisualState>
|
||||||
<VisualState x:Name="ButtonHideRemove">
|
<VisualState x:Name="ButtonHideRemove">
|
||||||
|
@ -315,7 +315,11 @@ void EquationTextBox::UpdateCommonVisualState()
|
|||||||
{
|
{
|
||||||
String ^ state = nullptr;
|
String ^ state = nullptr;
|
||||||
|
|
||||||
if (m_HasFocus)
|
if (m_HasFocus && HasError)
|
||||||
|
{
|
||||||
|
state = "FocusedError";
|
||||||
|
}
|
||||||
|
else if (m_HasFocus)
|
||||||
{
|
{
|
||||||
state = "Focused";
|
state = "Focused";
|
||||||
}
|
}
|
||||||
@ -390,7 +394,12 @@ void EquationTextBox::OnRichEditMenuOpening(Object ^ /*sender*/, Object ^ /*args
|
|||||||
{
|
{
|
||||||
if (m_kgfEquationMenuItem != nullptr)
|
if (m_kgfEquationMenuItem != nullptr)
|
||||||
{
|
{
|
||||||
m_kgfEquationMenuItem->IsEnabled = EquationTextBox::RichEditHasContent();
|
m_kgfEquationMenuItem->IsEnabled = RichEditHasContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_colorChooserMenuItem != nullptr)
|
||||||
|
{
|
||||||
|
m_colorChooserMenuItem->IsEnabled = !HasError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4096,11 +4096,11 @@
|
|||||||
<comment>Title for KeyGraphFeatures Vertical Asymptotes Property</comment>
|
<comment>Title for KeyGraphFeatures Vertical Asymptotes Property</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="XIntercept" xml:space="preserve">
|
<data name="XIntercept" xml:space="preserve">
|
||||||
<value>X Intercept</value>
|
<value>X-Intercept</value>
|
||||||
<comment>Title for KeyGraphFeatures XIntercept Property</comment>
|
<comment>Title for KeyGraphFeatures XIntercept Property</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="YIntercept" xml:space="preserve">
|
<data name="YIntercept" xml:space="preserve">
|
||||||
<value>Y Intercept</value>
|
<value>Y-Intercept</value>
|
||||||
<comment>Title for KeyGraphFeatures YIntercept Property</comment>
|
<comment>Title for KeyGraphFeatures YIntercept Property</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="KGFAnalysisCouldNotBePerformed" xml:space="preserve">
|
<data name="KGFAnalysisCouldNotBePerformed" xml:space="preserve">
|
||||||
|
@ -650,6 +650,7 @@
|
|||||||
<!-- Ideally the KeyGraphFeaturesPanel should be a frame so that navigation to and from the panel could be handled nicely -->
|
<!-- Ideally the KeyGraphFeaturesPanel should be a frame so that navigation to and from the panel could be handled nicely -->
|
||||||
<local:KeyGraphFeaturesPanel x:Name="KeyGraphFeaturesControl"
|
<local:KeyGraphFeaturesPanel x:Name="KeyGraphFeaturesControl"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
|
Margin="0,4,0,0"
|
||||||
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
|
KeyGraphFeaturesClosed="OnKeyGraphFeaturesClosed"
|
||||||
ViewModel="{x:Bind EquationInputAreaControl.EquationVM, Mode=OneWay}"
|
ViewModel="{x:Bind EquationInputAreaControl.EquationVM, Mode=OneWay}"
|
||||||
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"
|
Visibility="{x:Bind IsKeyGraphFeaturesVisible, Mode=OneWay}"
|
||||||
|
@ -151,7 +151,12 @@ void GraphingCalculator::OnEquationsVectorChanged(IObservableVector<EquationView
|
|||||||
|
|
||||||
void GraphingCalculator::OnTracePointChanged(Windows::Foundation::Point newPoint)
|
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);
|
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)
|
void CalculatorApp::GraphingCalculator::ActiveTracing_Checked(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
|
GraphingControl->Focus(::FocusState::Programmatic);
|
||||||
|
|
||||||
m_activeTracingKeyUpToken = Window::Current->CoreWindow->KeyUp +=
|
m_activeTracingKeyUpToken = Window::Current->CoreWindow->KeyUp +=
|
||||||
ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow ^, Windows::UI::Core::KeyEventArgs ^>(
|
ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow ^, Windows::UI::Core::KeyEventArgs ^>(
|
||||||
this, &CalculatorApp::GraphingCalculator::ActiveTracing_KeyUp);
|
this, &CalculatorApp::GraphingCalculator::ActiveTracing_KeyUp);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="controls:EquationTextBox">
|
<ControlTemplate TargetType="controls:EquationTextBox">
|
||||||
<Grid>
|
<Grid Background="{ThemeResource TextControlBackground}">
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
@ -102,7 +102,7 @@
|
|||||||
<Setter Property="IsReadOnly" Value="True"/>
|
<Setter Property="IsReadOnly" Value="True"/>
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="IsEnabled" Value="True"/>
|
<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="UseSystemFocusVisuals" Value="True"/>
|
||||||
<Setter Property="TextWrapping" Value="NoWrap"/>
|
<Setter Property="TextWrapping" Value="NoWrap"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||||
@ -169,8 +169,8 @@
|
|||||||
<Border x:Name="BorderElement"
|
<Border x:Name="BorderElement"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.RowSpan="1"
|
Grid.RowSpan="1"
|
||||||
MinWidth="{ThemeResource TextControlThemeMinWidth}"
|
MinWidth="0"
|
||||||
MinHeight="{ThemeResource TextControlThemeMinHeight}"
|
MinHeight="0"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
@ -224,6 +224,7 @@
|
|||||||
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
|
<Style x:Name="KGF_TextBlockStyle" TargetType="TextBlock">
|
||||||
<Setter Property="FontWeight" Value="Normal"/>
|
<Setter Property="FontWeight" Value="Normal"/>
|
||||||
<Setter Property="FontSize" Value="14"/>
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
<Setter Property="IsTextSelectionEnabled" Value="True"/>
|
||||||
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
<Setter Property="TextWrapping" Value="WrapWholeWords"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
@ -243,6 +244,11 @@
|
|||||||
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
Style="{StaticResource KGF_TitleTextBlockStyle}"
|
||||||
Text="{x:Bind Title, Mode=OneWay}"/>
|
Text="{x:Bind Title, Mode=OneWay}"/>
|
||||||
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
<ItemsControl ItemsSource="{x:Bind DisplayItems, Mode=OneWay}" UseSystemFocusVisuals="True">
|
||||||
|
<ItemsControl.ItemContainerStyle>
|
||||||
|
<Style TargetType="ContentPresenter">
|
||||||
|
<Setter Property="Margin" Value="0"/>
|
||||||
|
</Style>
|
||||||
|
</ItemsControl.ItemContainerStyle>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate x:DataType="x:String">
|
<DataTemplate x:DataType="x:String">
|
||||||
<controls:MathRichEditBox HorizontalAlignment="Left"
|
<controls:MathRichEditBox HorizontalAlignment="Left"
|
||||||
@ -265,7 +271,7 @@
|
|||||||
<DataTemplate x:DataType="vm:GridDisplayItems">
|
<DataTemplate x:DataType="vm:GridDisplayItems">
|
||||||
<Grid VerticalAlignment="Center">
|
<Grid VerticalAlignment="Center">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto" MinWidth="64"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<controls:MathRichEditBox Grid.Column="0"
|
<controls:MathRichEditBox Grid.Column="0"
|
||||||
@ -308,7 +314,7 @@
|
|||||||
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
<converters:BooleanToVisibilityNegationConverter x:Name="BooleanToVisibilityNegationConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid Margin="0,7,0,0" Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
@ -335,8 +341,7 @@
|
|||||||
|
|
||||||
<ListView x:Name="KeyGraphFeaturesListView"
|
<ListView x:Name="KeyGraphFeaturesListView"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Margin="12,10,10,0"
|
Padding="12,10,10,12"
|
||||||
Padding="0,0,0,12"
|
|
||||||
IsItemClickEnabled="False"
|
IsItemClickEnabled="False"
|
||||||
ItemContainerStyle="{StaticResource KGF_ListViewItemContainerStyle}"
|
ItemContainerStyle="{StaticResource KGF_ListViewItemContainerStyle}"
|
||||||
ItemTemplateSelector="{StaticResource KGFTemplateSelector}"
|
ItemTemplateSelector="{StaticResource KGFTemplateSelector}"
|
||||||
@ -350,6 +355,7 @@
|
|||||||
Margin="12,10,10,0"
|
Margin="12,10,10,0"
|
||||||
Style="{StaticResource KGF_TextBlockStyle}"
|
Style="{StaticResource KGF_TextBlockStyle}"
|
||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
|
IsTextSelectionEnabled="False"
|
||||||
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
Text="{x:Bind ViewModel.AnalysisErrorString, Mode=OneWay}"
|
||||||
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
Visibility="{x:Bind ViewModel.AnalysisErrorVisible, Mode=OneWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <concrt.h>
|
#include <concrt.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
// C++\WinRT Headers
|
// C++\WinRT Headers
|
||||||
#include "winrt/base.h"
|
#include "winrt/base.h"
|
||||||
|
@ -621,10 +621,9 @@ namespace GraphControl
|
|||||||
|
|
||||||
void Grapher::UpdateTracingChanged()
|
void Grapher::UpdateTracingChanged()
|
||||||
{
|
{
|
||||||
if (m_renderMain->Tracing || m_renderMain->ActiveTracing)
|
if (m_renderMain->Tracing)
|
||||||
{
|
{
|
||||||
TracingChangedEvent(true);
|
TracingChangedEvent(true);
|
||||||
|
|
||||||
TracingValueChangedEvent(m_renderMain->TraceValue);
|
TracingValueChangedEvent(m_renderMain->TraceValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -650,11 +649,7 @@ namespace GraphControl
|
|||||||
if (m_renderMain)
|
if (m_renderMain)
|
||||||
{
|
{
|
||||||
m_renderMain->DrawNearestPoint = false;
|
m_renderMain->DrawNearestPoint = false;
|
||||||
if (ActiveTracing == false)
|
|
||||||
{
|
|
||||||
// IF we are active tracing we never want to hide the popup..
|
|
||||||
TracingChangedEvent(false);
|
TracingChangedEvent(false);
|
||||||
}
|
|
||||||
e->Handled = true;
|
e->Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace GraphControl::DX
|
|||||||
, m_backgroundColor{ {} }
|
, m_backgroundColor{ {} }
|
||||||
, m_swapChainPanel{ panel }
|
, m_swapChainPanel{ panel }
|
||||||
, m_TraceValue(Point(0, 0))
|
, m_TraceValue(Point(0, 0))
|
||||||
, m_TraceLocation(Point(0,0))
|
, m_TraceLocation(Point(0, 0))
|
||||||
, m_Tracing(false)
|
, m_Tracing(false)
|
||||||
, m_ActiveTracingPointRenderer{ &m_deviceResources }
|
, m_ActiveTracingPointRenderer{ &m_deviceResources }
|
||||||
{
|
{
|
||||||
@ -195,6 +195,14 @@ namespace GraphControl::DX
|
|||||||
|
|
||||||
if (!isnan(nearestPointLocation.X) && !isnan(nearestPointLocation.Y))
|
if (!isnan(nearestPointLocation.X) && !isnan(nearestPointLocation.Y))
|
||||||
{
|
{
|
||||||
|
auto lineColors = m_graph->GetOptions().GetGraphColors();
|
||||||
|
|
||||||
|
if (formulaId >= 0 && formulaId < lineColors.size())
|
||||||
|
{
|
||||||
|
auto dotColor = lineColors[formulaId];
|
||||||
|
m_nearestPointRenderer.SetColor(D2D1::ColorF(dotColor.R * 65536 + dotColor.G * 256 + dotColor.B, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
m_nearestPointRenderer.Render(nearestPointLocation);
|
m_nearestPointRenderer.Render(nearestPointLocation);
|
||||||
m_Tracing = true;
|
m_Tracing = true;
|
||||||
m_TraceLocation = Point(nearestPointLocation.X, nearestPointLocation.Y);
|
m_TraceLocation = Point(nearestPointLocation.X, nearestPointLocation.Y);
|
||||||
|
Loading…
Reference in New Issue
Block a user