Replot the graph when the user clicks Graph View after manually updating the graph range (#1254)

* Reset the graph by replotting if the graph range was changed by the user

* When calling SetDisplayRanges, just set Replot to true instead of passing in a parameter
This commit is contained in:
Stephanie Anderl 2020-06-02 12:58:06 -07:00 committed by GitHub
parent 52ba3755ff
commit 20df252d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -120,11 +120,20 @@ namespace GraphControl
{
if (auto renderer = m_graph->GetRenderer())
{
if (SUCCEEDED(renderer->ResetRange()))
if (m_replot)
{
IsKeepCurrentView = false;
m_replot = false;
TryPlotGraph(false, false);
}
else if (SUCCEEDED(renderer->ResetRange()))
{
m_renderMain->RunRenderPass();
GraphViewChangedEvent(this, GraphViewChangedReason::Reset);
}
GraphViewChangedEvent(this, GraphViewChangedReason::Reset);
return;
}
}
}
@ -1093,10 +1102,13 @@ optional<vector<shared_ptr<Graphing::IEquation>>> Grapher::TryInitializeGraph(bo
auto initResult = m_graph->TryInitialize(graphingExp);
m_graph->GetRenderer()->SetDisplayRanges(xMin, xMax, yMin, yMax);
m_replot = true;
return initResult;
}
else
{
m_replot = false;
return m_graph->TryInitialize(graphingExp);
}
}

View File

@ -254,6 +254,7 @@ public enum class GraphViewChangedReason
if (auto render = m_graph->GetRenderer())
{
render->SetDisplayRanges(xMin, xMax, yMin, yMax);
m_replot = true;
if (m_renderMain)
{
m_renderMain->RunRenderPass();
@ -351,6 +352,7 @@ public enum class GraphViewChangedReason
Windows::UI::Core::CoreCursor ^ m_cachedCursor;
int m_errorType;
int m_errorCode;
bool m_replot;
public:
Windows::Storage::Streams::RandomAccessStreamReference ^ GetGraphBitmapStream();