mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
fixed a bug in the element move mouse controller
This commit is contained in:
parent
911766771f
commit
0c550d4a32
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user