Allow line style to be changed (#1097)

* add line style

* start line style

* More fixes

* undo key

* more tweaks

* address comments

* Fix merge
This commit is contained in:
Pepe Rivera
2020-03-27 09:56:11 -07:00
committed by GitHub
parent 7dcfe0439c
commit fec7c907f8
10 changed files with 383 additions and 92 deletions

View File

@@ -558,13 +558,14 @@ namespace GraphControl
auto lineColor = eq->LineColor;
graphColors.emplace_back(lineColor.R, lineColor.G, lineColor.B, lineColor.A);
if (eq->GraphedEquation)
if (eq->GraphedEquation)
{
if (!eq->HasGraphError && eq->IsSelected)
{
eq->GraphedEquation->TrySelectEquation();
}
eq->GraphedEquation->GetGraphEquationOptions()->SetLineStyle(static_cast<::Graphing::Renderer::LineStyle>(eq->EquationStyle));
eq->GraphedEquation->GetGraphEquationOptions()->SetLineWidth(LineWidth);
eq->GraphedEquation->GetGraphEquationOptions()->SetSelectedEquationLineWidth(LineWidth + ((LineWidth <= 2) ? 1 : 2));
}

View File

@@ -26,6 +26,7 @@ namespace GraphControl
{
wstring request;
wstring_view expr{ Expression->Data() };
IsInequality = false;
// 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
@@ -33,6 +34,8 @@ namespace GraphControl
|| expr.find(L">&lt;<") != wstring_view::npos || expr.find(L">&gt;<") != wstring_view::npos)
{
request = L"<mrow><mi>plotIneq2D</mi><mfenced separators=\"\">";
IsInequality = true;
EquationStyle = EquationLineStyle::Dash;
}
else if (expr.find(L">=<") != wstring_view::npos)
{

View File

@@ -7,6 +7,16 @@
namespace GraphControl
{
public
enum class EquationLineStyle : int
{
Solid,
Dot,
Dash,
DashDot,
DashDotDot
};
public enum class ErrorType
{
Evaluation,
@@ -211,7 +221,9 @@ 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, IsInequality);
OBSERVABLE_NAMED_PROPERTY_RW(bool, IsSelected);
OBSERVABLE_NAMED_PROPERTY_RW(EquationLineStyle, EquationStyle);
OBSERVABLE_NAMED_PROPERTY_RW(ErrorType, GraphErrorType);
OBSERVABLE_NAMED_PROPERTY_RW(int, GraphErrorCode);
@@ -221,12 +233,10 @@ namespace GraphControl
void set(Windows::UI::Color value);
}
static property Platform::String
^ LineColorPropertyName { Platform::String ^ get(); }
public : Platform::String
^ GetRequest();
static property Platform::String ^ LineColorPropertyName { Platform::String ^ get(); }
public:
Platform::String ^ GetRequest();
bool IsGraphableEquation();
internal:

View File

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