fixed a bug in the state management

This commit is contained in:
hneemann 2017-09-11 16:42:50 +02:00
parent d2ec993056
commit adec19bc5c
3 changed files with 17 additions and 5 deletions

View File

@ -1042,6 +1042,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
circuitComponent.setManualChangeObserver(new MicroStepObserver(model));
}
});
stateManager.setActualState(stoppedState);
}
private void clearModelDescription() {

View File

@ -43,13 +43,15 @@ public class ModifyMoveSelected implements Modification {
@Override
public void modify(Circuit circuit, ElementLibrary library) {
ArrayList<Movable> list = circuit.getElementsToMove(min, max);
for (Movable m : list)
m.move(accumulatedDelta);
if (list != null) {
for (Movable m : list)
m.move(accumulatedDelta);
for (int i = 0; i < accumulatedRotate; i++)
rotateElements(list, center);
for (int i = 0; i < accumulatedRotate; i++)
rotateElements(list, center);
circuit.elementsMoved();
circuit.elementsMoved();
}
}
/**

View File

@ -48,4 +48,13 @@ public class StateManager {
public boolean isActive(State 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;
}
}