Selaa lähdekoodia

Merge pull request #789 from cpinter/chart-extent-improvements

BUG: Re-add range reset on bounds change if range is invalid
Jean-Christophe Fillion-Robin 7 vuotta sitten
vanhempi
commit
550eef7d6c
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 10 0
      Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsView.cpp

+ 10 - 0
Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsView.cpp

@@ -139,6 +139,16 @@ void ctkVTKScalarsToColorsView::addPlot(vtkPlot* plot)
 void ctkVTKScalarsToColorsView::onBoundsChanged()
 {
   this->boundAxesToChartBounds();
+
+  // Set range to bounds only if range is invalid. Otherwise keep it as is, because
+  // the user wants to keep the range they set after a transfer function is shifted
+  double extent[8];
+  this->chartExtent(extent);
+  if (extent[0] >= extent[1])
+    {
+    this->setAxesToChartBounds();
+    }
+
   this->Superclass::onChartUpdated();
 }