Prevent the graph to pan/zoom in some cases (#897)

* prevent the graph to change ranges when hide/show an equation or change the trig unit

* make sure to not zoom/pan when we hide the last visible equation
This commit is contained in:
Rudy Huyn
2020-01-06 13:10:53 -08:00
committed by Pepe Rivera
parent 8357f5d5c5
commit 7aaeee934c
5 changed files with 45 additions and 43 deletions

View File

@@ -104,7 +104,13 @@ public
event Windows::Foundation::EventHandler<Windows::Foundation::Collections::IMap<Platform::String ^, double> ^> ^ VariablesUpdated;
void SetVariable(Platform::String ^ variableName, double newValue);
Platform::String ^ ConvertToLinear(Platform::String ^ mmlString);
void PlotGraph();
/// <summary>
/// Draw the graph. Call this method if you add or modify an equation.
/// </summary>
/// <param name="keepCurrentView">Force the graph control to not pan or zoom to adapt the view.</param>
void PlotGraph(bool keepCurrentView);
GraphControl::KeyGraphFeaturesInfo ^ AnalyzeEquation(GraphControl::Equation ^ equation);
// We can't use the EvalTrigUnitMode enum directly in as the property type because it comes from another module which doesn't expose
@@ -116,7 +122,7 @@ public
if (value != (int)m_solver->EvalOptions().GetTrigUnitMode())
{
m_solver->EvalOptions().SetTrigUnitMode((Graphing::EvalTrigUnitMode)value);
PlotGraph();
PlotGraph(true);
}
}
@@ -265,8 +271,8 @@ public
void OnEquationChanged(Equation ^ equation);
void OnEquationStyleChanged(Equation ^ equation);
void OnEquationLineEnabledChanged(Equation ^ equation);
bool TryUpdateGraph();
void TryPlotGraph(bool shouldRetry);
bool TryUpdateGraph(bool keepCurrentView);
void TryPlotGraph(bool keepCurrentView, bool shouldRetry);
void UpdateGraphOptions(Graphing::IGraphingOptions& options, const std::vector<Equation ^>& validEqs);
std::vector<Equation ^> GetGraphableEquations();
void SetGraphArgs();
@@ -284,7 +290,7 @@ public
void SetEquationsAsValid();
void SetEquationErrors();
std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>> TryInitializeGraph(bool keepCurrentView, _In_ const Graphing::IExpression* graphingExp = nullptr);
private:
DX::RenderMain ^ m_renderMain = nullptr;