Skip to content

Commit 032cdd4

Browse files
committed
Hard snap to position
1 parent 0eb16f8 commit 032cdd4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,15 @@ private boolean snapBondToPosition(IAtom beg, IBond bond, Point2d tP) {
294294
boolean okay = newdot >= 0.97;
295295

296296
// hard snap to expected position
297-
if (okay) {
297+
if (newdot > dot) {
298298
theta = Math.atan2(curr.y, curr.x) - Math.atan2(dest.y, dest.x);
299299
rotate(end.getPoint2d(), bP, Math.cos(theta), Math.sin(theta));
300300
} else if (newdot < dot) {
301-
// reflect it back
301+
// reflect it back then snap
302302
GeometryUtil.reflect(visit.keySet(),
303303
reflectBond.getBegin().getPoint2d(),
304304
reflectBond.getEnd().getPoint2d());
305+
rotate(end.getPoint2d(), bP, Math.cos(theta), Math.sin(theta));
305306
}
306307

307308
return okay;

0 commit comments

Comments
 (0)