mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 14:56:29 -04:00
When a new fsm transition is created, the last condition is preset.
This commit is contained in:
parent
00bb9af059
commit
a772ae3eba
@ -50,6 +50,7 @@ public class FSMComponent extends JComponent {
|
||||
private Vector lastMousePos;
|
||||
private State newTransitionFromState;
|
||||
private Vector newTransitionStartPos;
|
||||
private String lastCondition = "";
|
||||
|
||||
/**
|
||||
* Creates a new component
|
||||
@ -102,7 +103,7 @@ public class FSMComponent extends JComponent {
|
||||
if (newTransitionStartPos.sub(posVector).len() > MIN_NEW_TRANS_DIST) {
|
||||
Movable target = fsm.getMovable(posVector);
|
||||
if (target instanceof State)
|
||||
fsm.add(new Transition(newTransitionFromState, (State) target, ""));
|
||||
fsm.add(new Transition(newTransitionFromState, (State) target, lastCondition));
|
||||
}
|
||||
newTransitionFromState = null;
|
||||
repaint();
|
||||
@ -235,7 +236,8 @@ public class FSMComponent extends JComponent {
|
||||
point, attr, KEY_CONDITION, KEY_VALUES);
|
||||
ElementAttributes newAttr = ad.showDialog();
|
||||
if (newAttr != null) {
|
||||
transition.setCondition(newAttr.get(KEY_CONDITION));
|
||||
lastCondition = newAttr.get(KEY_CONDITION);
|
||||
transition.setCondition(lastCondition);
|
||||
transition.setValues(newAttr.get(KEY_VALUES));
|
||||
repaint();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user