瀏覽代碼

BUG: Re-add range reset on bounds change if range is invalid

The setAxesToChartBounds call has recently been removed so that the chart extent is not reset when the transfer function bounds change. This prevented resetting the extent defined by the user when shifting the transfer function. However, if there was no valid extent defined, without this call the chart was not shown at all. By resetting the extent only if it was invalid solves both issues.
Csaba Pinter 7 年之前
父節點
當前提交
c923fdb9ea
共有 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();
 }