mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-14 07:17:13 -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 Vector lastMousePos;
|
||||||
private State newTransitionFromState;
|
private State newTransitionFromState;
|
||||||
private Vector newTransitionStartPos;
|
private Vector newTransitionStartPos;
|
||||||
|
private String lastCondition = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new component
|
* Creates a new component
|
||||||
@ -102,7 +103,7 @@ public class FSMComponent extends JComponent {
|
|||||||
if (newTransitionStartPos.sub(posVector).len() > MIN_NEW_TRANS_DIST) {
|
if (newTransitionStartPos.sub(posVector).len() > MIN_NEW_TRANS_DIST) {
|
||||||
Movable target = fsm.getMovable(posVector);
|
Movable target = fsm.getMovable(posVector);
|
||||||
if (target instanceof State)
|
if (target instanceof State)
|
||||||
fsm.add(new Transition(newTransitionFromState, (State) target, ""));
|
fsm.add(new Transition(newTransitionFromState, (State) target, lastCondition));
|
||||||
}
|
}
|
||||||
newTransitionFromState = null;
|
newTransitionFromState = null;
|
||||||
repaint();
|
repaint();
|
||||||
@ -235,7 +236,8 @@ public class FSMComponent extends JComponent {
|
|||||||
point, attr, KEY_CONDITION, KEY_VALUES);
|
point, attr, KEY_CONDITION, KEY_VALUES);
|
||||||
ElementAttributes newAttr = ad.showDialog();
|
ElementAttributes newAttr = ad.showDialog();
|
||||||
if (newAttr != null) {
|
if (newAttr != null) {
|
||||||
transition.setCondition(newAttr.get(KEY_CONDITION));
|
lastCondition = newAttr.get(KEY_CONDITION);
|
||||||
|
transition.setCondition(lastCondition);
|
||||||
transition.setValues(newAttr.get(KEY_VALUES));
|
transition.setValues(newAttr.get(KEY_VALUES));
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user