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:
		| @@ -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); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user