Commit cec79416 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell

ENH: Ensure charts are removed correctly in resizes.

This commit ensures that a chart is removed from the scene if it will no
longer be part of the chart matrix.

Change-Id: I0e7c7065aa836f9372b5143e8adeac211ce7d9f8
parent b025350e
......@@ -85,6 +85,14 @@ void vtkChartMatrix::SetSize(const vtkVector2i &size)
if (this->Size.X() != size.X() || this->Size.Y() != size.Y())
{
this->Size = size;
if (size.X() * size.Y() < static_cast<int>(this->Private->Charts.size()))
{
for (int i = static_cast<int>(this->Private->Charts.size() - 1);
i >= size.X() * size.Y(); --i)
{
this->RemoveItem(this->Private->Charts[i]);
}
}
this->Private->Charts.resize(size.X() * size.Y());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment