Skip to content

Commit a707335

Browse files
committed
Charge label also needs to be nudged over.
1 parent 36b04af commit a707335

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,12 @@ AtomSymbol generatePeriodicSymbol(final int number, final int hydrogens, int mas
417417

418418
// when the hydrogen label is positioned to the left we may need to nudge it
419419
// over to account for the hydrogen count and/or the mass adjunct colliding
420-
// with the element label
420+
// with the element label, we also need to move the charge too '+H3N'
421421
if (position == Left) {
422422
final double nudgeX = hydrogenXDodge(hydrogens, mass, element, hydrogenAdjunct, hydrogenCount, massAdjunct);
423423
hydrogenAdjunct = hydrogenAdjunct.translate(nudgeX, 0);
424424
hydrogenCount = hydrogenCount.translate(nudgeX, 0);
425+
chargeAdjunct = chargeAdjunct.translate(nudgeX, 0);
425426
}
426427

427428
final List<TextOutline> adjuncts = new ArrayList<TextOutline>(4);

0 commit comments

Comments
 (0)