fix bugs (#934)
This commit is contained in:
parent
027eab12a3
commit
ca0b3d83e8
@ -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";
|
||||
|
@ -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=""/>
|
||||
|
@ -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;
|
||||
|
@ -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">><") != wstring_view::npos || expr.find(L"><<") != wstring_view::npos || expr.find(L">≥<") != wstring_view::npos
|
||||
|| expr.find(L">≤<") != wstring_view::npos)
|
||||
|| expr.find(L">≤<") != wstring_view::npos || expr.find(8805) != wstring_view::npos || expr.find(8804) != wstring_view::npos
|
||||
|| expr.find(L"><<") != wstring_view::npos
|
||||
|| expr.find(L">><") != 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=\"\">";
|
||||
|
Loading…
Reference in New Issue
Block a user