From: Jim Procter Date: Fri, 21 Feb 2020 15:12:18 +0000 (+0000) Subject: JAL-3186 ensure transparency slider position is updated on revert X-Git-Tag: Develop-2_11_2_0-d20201215~99 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5cb291ae74e32b604fa445abe1691b26ca25848c;p=jalview.git JAL-3186 ensure transparency slider position is updated on revert --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index dc7283b..3efc63e 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -188,12 +188,22 @@ public class FeatureSettings extends JPanel { // save transparency for restore on Cancel originalTransparency = fr.getTransparency(); - int originalTransparencyAsPercent = (int) (originalTransparency * 100); - transparency.setMaximum(100 - originalTransparencyAsPercent); + + updateTransparencySliderFromFR(); originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy originalViewStyle = new ViewStyle(af.viewport.getViewStyle()); } + + private void updateTransparencySliderFromFR() + { + boolean incon = inConstruction; + inConstruction = true; + + int transparencyAsPercent = (int) (fr.getTransparency() * 100); + transparency.setValue(100 - transparencyAsPercent); + inConstruction = incon; + } /** * Constructor * @@ -203,7 +213,9 @@ public class FeatureSettings extends JPanel { this.af = alignFrame; fr = af.getFeatureRenderer(); + storeOriginalSettings(); + try { jbInit(); @@ -1310,6 +1322,7 @@ public class FeatureSettings extends JPanel public void actionPerformed(ActionEvent e) { revert(); + refreshDisplay(); if (!hasComplement) { close(); @@ -2052,6 +2065,7 @@ public class FeatureSettings extends JPanel fr.setFeatureFilters(originalFilters); updateFeatureRenderer(originalData); af.getViewport().setViewStyle(originalViewStyle); + updateTransparencySliderFromFR(); updateComplementButtons(); refreshDisplay(); }