mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-29 16:01:19 -04:00
fixed a bug in the state management
This commit is contained in:
parent
d2ec993056
commit
adec19bc5c
@ -1042,6 +1042,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
circuitComponent.setManualChangeObserver(new MicroStepObserver(model));
|
circuitComponent.setManualChangeObserver(new MicroStepObserver(model));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
stateManager.setActualState(stoppedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearModelDescription() {
|
private void clearModelDescription() {
|
||||||
|
@ -43,13 +43,15 @@ public class ModifyMoveSelected implements Modification {
|
|||||||
@Override
|
@Override
|
||||||
public void modify(Circuit circuit, ElementLibrary library) {
|
public void modify(Circuit circuit, ElementLibrary library) {
|
||||||
ArrayList<Movable> list = circuit.getElementsToMove(min, max);
|
ArrayList<Movable> list = circuit.getElementsToMove(min, max);
|
||||||
for (Movable m : list)
|
if (list != null) {
|
||||||
m.move(accumulatedDelta);
|
for (Movable m : list)
|
||||||
|
m.move(accumulatedDelta);
|
||||||
|
|
||||||
for (int i = 0; i < accumulatedRotate; i++)
|
for (int i = 0; i < accumulatedRotate; i++)
|
||||||
rotateElements(list, center);
|
rotateElements(list, center);
|
||||||
|
|
||||||
circuit.elementsMoved();
|
circuit.elementsMoved();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,4 +48,13 @@ public class StateManager {
|
|||||||
public boolean isActive(State state) {
|
public boolean isActive(State state) {
|
||||||
return actualState == state;
|
return actualState == state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the actual state. Ony used to init the state manager
|
||||||
|
*
|
||||||
|
* @param active the state which is active.
|
||||||
|
*/
|
||||||
|
public void setActualState(State active) {
|
||||||
|
this.actualState = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user