Adds zoom buttons to graph controls (#637)
This commit is contained in:
committed by
Pepe Rivera
parent
c1efa3d3e3
commit
1c9755d38a
@@ -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)));
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user