@@ -60,8 +60,9 @@ public class SystemInputFrame extends UIFrame {
6060 private StateVar <SystemMode > curMode ;
6161 private EquationSystem .Builder builder ;
6262 private PlotData curData ;
63-
6463 private Consumer <PlotData > updater ;
64+
65+ private int solnPointNum = 0 ;
6566 private UIInput [] inputEqns ;
6667
6768 public SystemInputFrame () {
@@ -104,13 +105,13 @@ private void initInputDialog() {
104105
105106 private JToolBar createToolbarUI (final List <Axis > axes ) {
106107 var plot2dCondition = curMode .when (mode ->
107- (mode == SystemMode .ODE && noOfEqns () == 2 )
108+ (mode == SystemMode .ODE && noOfEqns () == 2 && solnPointNum == 2 )
108109 || (mode == SystemMode .DFE && noOfEqns () >= 1 )
109110 || (mode == SystemMode .FN1 && noOfEqns () == 1 )
110111 );
111112
112113 var plot3dCondition = curMode .when (mode ->
113- (mode == SystemMode .ODE && noOfEqns () == 3 )
114+ (mode == SystemMode .ODE && noOfEqns () == 3 && solnPointNum == 3 )
114115 || (mode == SystemMode .FN2 && noOfEqns () == 1 )
115116 );
116117
@@ -235,7 +236,7 @@ private UIGrid createEqnInputUIPanel(final List<Axis> axes) {
235236 .column (
236237 inputEqns [i ] = input ()
237238 .chars (10 )
238- .enabled (eqnCondition .get (idx ))
239+ .visible (eqnCondition .get (idx ))
239240 .onChange (text -> {
240241 builder .eqn (idx , text );
241242 // FIXME find a better way than this to update UI
@@ -255,7 +256,18 @@ private UIGrid createEqnInputUIPanel(final List<Axis> axes) {
255256 input ()
256257 .chars (3 )
257258 .enabled (inputConditions .get (idx ))
258- .onChange (text -> builder .solnPoint (idx , Double .parseDouble (text )))
259+ .onChange (text -> {
260+ if (!text .isEmpty ()) {
261+ solnPointNum ++;
262+ builder .solnPoint (idx , Double .parseDouble (text ));
263+ } else {
264+ solnPointNum --;
265+ builder .solnPoint (idx , 0.0 );
266+ }
267+
268+ // FIXME find a better way than this to update UI
269+ curMode .set (curMode .get ());
270+ })
259271 ))
260272 )
261273 )
0 commit comments