Permalink
Browse files

fix two bugs found by martin

  • Loading branch information...
chemhack committed Oct 14, 2009
1 parent dd58256 commit 7f7096431d8000c6160cf304197215905266ea3a
@@ -177,11 +177,18 @@ public void onMouseUp(Widget sender, int x, int y) {
Atom newAtom = controller.getMolecule().addAtom(controller.currentElement, realCord.x, realCord.y, 0);
}
break;
case drawBenzene:
if (isClick) {
Point2D realCord = controller.graphCordToRealCord(new Point2D(x, y));
Atom newAtom = controller.getMolecule().addAtom("C", realCord.x, realCord.y, 0);
MoleculePlacer.placeRingOnCurrentAtom(newAtom, controller.getRenderer().getRendererModel().getDefaultBondLength(), controller.currentRingSize, true);
}
break;
case drawRing:
if (isClick) {
Point2D realCord = controller.graphCordToRealCord(new Point2D(x, y));
Atom newAtom = controller.getMolecule().addAtom("C", realCord.x, realCord.y, 0);
MoleculePlacer.placeRingOnCurrentAtom(newAtom, controller.getRenderer().getRendererModel().getDefaultBondLength(), controller.currentRingSize, false);
MoleculePlacer.placeRingOnCurrentAtom(newAtom, controller.getRenderer().getRendererModel().getDefaultBondLength(), controller.currentRingSize, false);
}
break;
default:
@@ -24,7 +24,7 @@
private ToggleButton tbSquare;
private ToggleButton tbTriangle;
public TopToolBox(final EditorController controller, ToggleButtonListener toggleButtonListener) {
public TopToolBox(final EditorController controller, final ToggleButtonListener toggleButtonListener) {
super();
this.toggleButtonListener = toggleButtonListener;
@@ -65,7 +65,9 @@ public void onClick(Widget sender) {
tbSingleBond = createToggleButton(myImageBundle.singleBondSmall(), "Single Bond");
tbSingleBond.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
controller.currentAction = EditorController.EditActions.drawSingleBond;
controller.selectElement("C");
toggleButtonListener.onClick(sender);
controller.currentAction = EditorController.EditActions.drawSingleBond;
}
});
tbSingleBond.setDown(true);
@@ -74,6 +76,8 @@ public void onClick(Widget sender) {
tbDoubleBond = createToggleButton(myImageBundle.doubleBondSmall(), "Double Bond");
tbDoubleBond.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
controller.selectElement("C");
toggleButtonListener.onClick(sender);
controller.currentAction = EditorController.EditActions.drawDoubleBond;
}
});
@@ -82,7 +86,9 @@ public void onClick(Widget sender) {
tbTripleBond = createToggleButton(myImageBundle.tripleBondSmall(), "Triple Bond");
tbTripleBond.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
controller.currentAction = EditorController.EditActions.drawTrippleBond;
controller.selectElement("C");
toggleButtonListener.onClick(sender);
controller.currentAction = EditorController.EditActions.drawTrippleBond;
}
});
this.add(tbTripleBond);

0 comments on commit 7f70964

Please sign in to comment.