Adds zoom buttons to graph controls (#637)

This commit is contained in:
Wei (Waley) Zhang
2019-08-16 16:11:43 -07:00
committed by Pepe Rivera
parent c1efa3d3e3
commit 1c9755d38a
6 changed files with 223 additions and 2 deletions

View File

@@ -92,6 +92,11 @@ namespace GraphControl
}
}
void Grapher::ZoomFromCenter(double scale)
{
ScaleRange(0, 0, scale);
}
void Grapher::ScaleRange(double centerX, double centerY, double scale)
{
if (m_graph != nullptr && m_renderMain != nullptr)
@@ -106,6 +111,20 @@ namespace GraphControl
}
}
void Grapher::ResetGrid()
{
if (m_graph != nullptr && m_renderMain != nullptr)
{
if (auto renderer = m_graph->GetRenderer())
{
if (SUCCEEDED(renderer->ResetRange()))
{
m_renderMain->RunRenderPass();
}
}
}
}
void Grapher::OnApplyTemplate()
{
auto swapChainPanel = dynamic_cast<SwapChainPanel^>(GetTemplateChild(StringReference(s_templateKey_SwapChainPanel)));

View File

@@ -127,6 +127,8 @@ namespace GraphControl
event Windows::Foundation::EventHandler<Windows::Foundation::Collections::IMap<Platform::String^, double>^>^ VariablesUpdated;
void SetVariable(Platform::String^ variableName, double newValue);
void ZoomFromCenter(double scale);
void ResetGrid();
protected:
#pragma region Control Overrides