Skip to content

Commit f7180e5

Browse files
committed
Allow whole molecules to be highlighted.
1 parent 3b140c3 commit f7180e5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,8 +979,15 @@ public DepictionGenerator withCarbonSymbols() {
979979
*/
980980
public DepictionGenerator withHighlight(Iterable<? extends IChemObject> chemObjs, Color color) {
981981
DepictionGenerator copy = new DepictionGenerator(this);
982-
for (IChemObject chemObj : chemObjs)
983-
copy.highlight.put(chemObj, color);
982+
for (IChemObject chemObj : chemObjs) {
983+
if (chemObj instanceof IAtomContainer) {
984+
for (IAtom atom : ((IAtomContainer) chemObj).atoms())
985+
copy.highlight.put(atom, color);
986+
for (IBond bond : ((IAtomContainer) chemObj).bonds())
987+
copy.highlight.put(bond, color);
988+
}
989+
else copy.highlight.put(chemObj, color);
990+
}
984991
return copy;
985992
}
986993

0 commit comments

Comments
 (0)