public void mouseMove(Point2d worldCoord) {
if ((System.nanoTime() - drawTime) < 4000000) {
return;
}
this.chemModelRelay.clearPhantoms();
IAtom closestAtom = chemModelRelay.getClosestAtom(worldCoord);
IBond closestBond = chemModelRelay.getClosestBond(worldCoord);
IChemObject singleSelection = getHighlighted( worldCoord,
closestAtom,closestBond );
if (singleSelection == null) {
//we build a phantom ring
IRing ring = this.chemModelRelay.getIChemModel().getBuilder().newInstance(IRing.class,ringSize, "C");
if (addingBenzene) {
ring.getBond(0).setOrder(IBond.Order.DOUBLE);
ring.getBond(2).setOrder(IBond.Order.DOUBLE);
ring.getBond(4).setOrder(IBond.Order.DOUBLE);
}
double bondLength = ((ControllerHub)this.chemModelRelay).calculateAverageBondLength(this.chemModelRelay.getIChemModel().getMoleculeSet());
ringPlacer.placeRing(ring, worldCoord, bondLength, RingPlacer.jcpAngles);
for(IAtom atom : ring.atoms())
this.chemModelRelay.addPhantomAtom(atom);
for(IBond atom : ring.bonds())
this.chemModelRelay.addPhantomBond(atom);
//and look if it would merge somewhere
chemModelRelay.getRenderer().getRenderer2DModel().getMerge().clear();
for(IAtom atom : ring.atoms()){
IAtom closestAtomInRing = this.chemModelRelay.getClosestAtom(atom);
if( closestAtomInRing != null) {
chemModelRelay.getRenderer().getRenderer2DModel().getMerge().put(closestAtomInRing, atom);
}
}
} else if (singleSelection instanceof IAtom) {