From: Ben Soares Date: Thu, 27 Oct 2022 12:23:16 +0000 (+0100) Subject: JAL-4083 only set globalUseScriptWait if needed X-Git-Tag: Release_2_11_4_0~520^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d1cf4609268fb7fbae0716b6e699a130eea02647;p=jalview.git JAL-4083 only set globalUseScriptWait if needed --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index a40da35..a529fae 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -269,11 +269,15 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel { if (atoms != null) { + // we set the globalUseScriptWait (and reset to previous value) only if + // we're going to use it here boolean useScriptWait = atoms.size() > 1; - boolean prevUseScriptWait = setGlobalUseScriptWait(useScriptWait); + boolean prevUseScriptWait = false; + if (useScriptWait) + prevUseScriptWait = setGlobalUseScriptWait(useScriptWait); if (resetLastRes.length() > 0) { - jmolScript(resetLastRes.toString()); + jmolScript(resetLastRes.toString(), useScriptWait); resetLastRes.setLength(0); } for (AtomSpec atom : atoms) @@ -281,7 +285,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(), atom.getChain(), atom.getPdbFile(), useScriptWait); } - setGlobalUseScriptWait(prevUseScriptWait); + if (useScriptWait) + setGlobalUseScriptWait(prevUseScriptWait); } }