This commit is contained in:
Pepe Rivera 2020-01-14 13:52:57 -08:00 committed by GitHub
parent 027eab12a3
commit ca0b3d83e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 4 deletions

View File

@ -273,19 +273,24 @@ void EquationTextBox::UpdateButtonsVisualState()
void EquationTextBox::UpdateCommonVisualState()
{
String ^ state = nullptr;
bool richEditHasContent = RichEditHasContent();
if (m_HasFocus && HasError)
{
state = "FocusedError";
}
else if (IsAddEquationMode && ((m_HasFocus || m_isPointerOver) && !RichEditHasContent()))
else if (IsAddEquationMode && m_HasFocus && !richEditHasContent)
{
state = "AddEquation";
state = "AddEquationFocused";
}
else if (m_HasFocus)
{
state = "Focused";
}
else if (IsAddEquationMode && m_isPointerOver && !richEditHasContent)
{
state = "AddEquation";
}
else if (HasError && (m_isPointerOver || m_isColorChooserFlyoutOpen))
{
state = "PointerOverError";

View File

@ -305,6 +305,16 @@
<Setter Target="EquationButton.IsEnabled" Value="false"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="AddEquationFocused">
<VisualState.Setters>
<Setter Target="FunctionNumberLabelTextBlock.Visibility" Value="Collapsed"/>
<Setter Target="EquationButton.Background" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
<Setter Target="EquationButton.BorderBrush" Value="{ThemeResource EquationButtonHideLineBackgroundBrush}"/>
<Setter Target="EquationButton.Foreground" Value="{ThemeResource EquationButtonHideLineForegroundBrush}"/>
<Setter Target="EquationButton.IsEnabled" Value="false"/>
<Setter Target="EquationBoxBorder.Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Error">
<VisualState.Setters>
<Setter Target="MathRichEditBox.PlaceholderText" Value=""/>

View File

@ -277,8 +277,15 @@ namespace GraphControl
{
request += L"<mo>,</mo>";
}
auto equationRequest = eq->GetRequest()->Data();
request += eq->GetRequest()->Data();
// If the equation request failed, then fail graphing.
if (equationRequest == nullptr)
{
return false;
}
request += equationRequest;
}
request += s_getGraphClosingTags;

View File

@ -29,7 +29,9 @@ namespace GraphControl
// Check for unicode characters of less than, less than or equal to, greater than and greater than or equal to.
if (expr.find(L">&#x3E;<") != wstring_view::npos || expr.find(L">&#x3C;<") != wstring_view::npos || expr.find(L">&#x2265;<") != wstring_view::npos
|| expr.find(L">&#x2264;<") != wstring_view::npos)
|| expr.find(L">&#x2264;<") != wstring_view::npos || expr.find(8805) != wstring_view::npos || expr.find(8804) != wstring_view::npos
|| expr.find(L">&lt;<") != wstring_view::npos
|| expr.find(L">&gt;<") != wstring_view::npos)
{
request = L"<mrow><mi>plotIneq2D</mi><mfenced separators=\"\">";
}
@ -37,6 +39,12 @@ namespace GraphControl
{
request = L"<mrow><mi>plotEq2d</mi><mfenced separators=\"\">";
}
// If the expression contains both x and y but no equal or inequality sign, then that cannot be graphed.
else if (expr.find(L">x<") != wstring_view::npos && (expr.find(L">y<") != wstring_view::npos))
{
return nullptr;
}
// Else default to plot2d
else
{
request = L"<mrow><mi>plot2d</mi><mfenced separators=\"\">";