Select the equation when the EquationTextBox has focus and during analysis (#1067)

* Select equation on focus

* PR comment
This commit is contained in:
Pepe Rivera
2020-03-12 10:12:01 -07:00
committed by GitHub
parent a2794b3705
commit 102782df47
7 changed files with 75 additions and 27 deletions

View File

@@ -179,6 +179,7 @@ namespace GraphControl
{
if (m_graph)
{
m_graph->TryResetSelection();
UpdateGraphOptions(m_graph->GetOptions(), GetGraphableEquations());
}
@@ -325,6 +326,13 @@ namespace GraphControl
if (initResult != nullopt)
{
auto graphedEquations = initResult.value();
for (int i = 0; i < validEqs.size(); i++)
{
validEqs[i]->GraphedEquation = graphedEquations[i];
}
UpdateGraphOptions(m_graph->GetOptions(), validEqs);
SetGraphArgs(m_graph);
@@ -498,6 +506,11 @@ namespace GraphControl
{
auto lineColor = eq->LineColor;
graphColors.emplace_back(lineColor.R, lineColor.G, lineColor.B, lineColor.A);
if (eq->IsSelected)
{
eq->GraphedEquation->TrySelectEquation();
}
}
options.SetGraphColors(graphColors);
}

View File

@@ -30,8 +30,7 @@ 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(8805) != wstring_view::npos || expr.find(8804) != wstring_view::npos
|| expr.find(L">&lt;<") != wstring_view::npos
|| expr.find(L">&gt;<") != 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=\"\">";
}

View File

@@ -17,6 +17,7 @@ namespace GraphControl
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsLineEnabled);
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsValidated);
OBSERVABLE_NAMED_PROPERTY_RW(bool, HasGraphError);
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsSelected);
property Windows::UI::Color LineColor
{
@@ -32,10 +33,24 @@ namespace GraphControl
bool IsGraphableEquation();
internal:
property std::shared_ptr<Graphing::IEquation> GraphedEquation
{
void set(std::shared_ptr<Graphing::IEquation> graphedEquation)
{
m_graphedEquation = graphedEquation;
}
std::shared_ptr<Graphing::IEquation> get()
{
return m_graphedEquation;
}
}
private:
std::wstring GetExpression();
private:
Windows::UI::Color m_LineColor;
std::shared_ptr<Graphing::IEquation> m_graphedEquation;
};
}

View File

@@ -158,7 +158,7 @@ public
{
auto equation = static_cast<Equation ^>(sender);
auto propertyName = args->PropertyName;
if (propertyName == GraphControl::Equation::LineColorPropertyName)
if (propertyName == GraphControl::Equation::LineColorPropertyName || propertyName == GraphControl::Equation::IsSelectedPropertyName)
{
EquationStyleChanged(equation);
}