소스 검색

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 년 전
부모
커밋
550eef7d6c
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  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();
 }