fixed a bug in the element move mouse controller

This commit is contained in:
hneemann 2018-01-13 11:42:58 +01:00
parent 911766771f
commit 0c550d4a32
2 changed files with 15 additions and 1 deletions

View File

@ -864,7 +864,10 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
}
}.setToolTip(Lang.get("menu_fast_tt")).setEnabledChain(false);
ToolTipAction stoppedStateAction = stoppedState.createToolTipAction(Lang.get("menu_element"), ICON_STOP).setToolTip(Lang.get("menu_element_tt"));
ToolTipAction stoppedStateAction = stoppedState
.createToolTipAction(Lang.get("menu_element"), ICON_STOP)
.setToolTip(Lang.get("menu_element_tt"))
.setEnabledChain(false);
ToolTipAction runTests = new ToolTipAction(Lang.get("menu_runTests"), ICON_TEST) {
@Override

View File

@ -1416,6 +1416,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
private Vector delta;
private Vector initialPos;
private int initialRot;
private boolean normalEnd;
private MouseControllerMoveElement(Cursor cursor) {
super(cursor);
@ -1430,6 +1431,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
deleteAction.setEnabled(true);
rotateAction.setEnabled(true);
copyAction.setEnabled(true);
normalEnd = false;
repaintNeeded();
}
@ -1440,6 +1442,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
if (!visualElement.getPos().equals(initialPos)
|| visualElement.getRotate() != initialRot)
addModificationAlreadyMade(new ModifyMoveAndRotElement(visualElement, initialPos));
normalEnd = true;
}
mouseNormal.activate();
}
@ -1487,6 +1490,14 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
mouseNormal.activate();
}
@Override
void deactivate() {
if (!normalEnd && !isLocked()) {
visualElement.setPos(raster(initialPos));
visualElement.setRotation(initialRot);
}
}
public VisualElement getVisualElement() {
return visualElement;
}