From 0ae197277308506be79cee82d872e08cecd64021 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Sat, 22 Jul 2017 14:48:22 +0100 Subject: [PATCH] JAL-2623 initialise colour threshold slider correctly --- src/jalview/appletgui/FeatureColourChooser.java | 10 ++-------- src/jalview/gui/FeatureColourChooser.java | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 0e85017..4075e8b 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -95,9 +95,11 @@ public class FeatureColourChooser extends Panel implements ActionListener, float mm[] = fr.getMinMax().get(type)[0]; min = mm[0]; max = mm[1]; + threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); oldcs = fr.getFeatureColours().get(type); if (oldcs.isGraduatedColour()) { + threshline.value = oldcs.getThreshold(); cs = new FeatureColour((FeatureColour) oldcs, min, max); } else @@ -384,14 +386,6 @@ public class FeatureColourChooser extends Panel implements ActionListener, thresholdValue.setText(""); } - else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD - && threshline == null) - { - // todo visual indication of feature threshold - threshline = new jalview.datamodel.GraphLine((max - min) / 2f, - "Threshold", Color.black); - } - if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) { adjusting = true; diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 5594e1a..a1c1bff 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -178,9 +178,10 @@ public class FeatureColourChooser extends JalviewDialog // initialise threshold slider and selector threshold.setSelectedIndex(cs.isAboveThreshold() ? 1 : 2); slider.setEnabled(true); + slider.setValue((int) (cs.getThreshold() * scaleFactor)); thresholdValue.setEnabled(true); threshline = new GraphLine((max - min) / 2f, "Threshold", Color.black); - + threshline.value = cs.getThreshold(); } adjusting = false; -- 1.7.10.2