[#2035] Add instances setting in launch lug config

This commit is contained in:
SiboVG 2023-02-12 09:27:36 +00:00
parent fc0d8bc438
commit 377fbf02f8
3 changed files with 18 additions and 5 deletions

View File

@ -274,7 +274,11 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
} }
} }
if (MathUtil.equals(this.instanceSeparation, _separation)) {
return;
}
this.instanceSeparation = _separation; this.instanceSeparation = _separation;
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
} }
@Override @Override
@ -285,9 +289,11 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
} }
} }
if( 0 < newCount ){ if (newCount == this.instanceCount || newCount <= 0) {
this.instanceCount = newCount; return;
} }
this.instanceCount = newCount;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
} }
@Override @Override

View File

@ -320,6 +320,9 @@ public class RailButton extends ExternalComponent implements AnglePositionable,
} }
} }
if (MathUtil.equals(this.instanceSeparation, _separation)) {
return;
}
this.instanceSeparation = _separation; this.instanceSeparation = _separation;
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
} }
@ -332,9 +335,10 @@ public class RailButton extends ExternalComponent implements AnglePositionable,
} }
} }
if( 0 < newCount ){ if (newCount == this.instanceCount || newCount <= 0) {
this.instanceCount = newCount; return;
} }
this.instanceCount = newCount;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
} }

View File

@ -92,7 +92,10 @@ public class LaunchLugConfig extends RocketComponentConfig {
order.add(((SpinnerEditor) spin.getEditor()).getTextField()); order.add(((SpinnerEditor) spin.getEditor()).getTextField());
panel.add(new UnitSelector(m), "growx"); panel.add(new UnitSelector(m), "growx");
panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap"); panel.add(new BasicSlider(m.getSliderModel(0, 0.01)), "w 100lp, wrap 30lp");
// -------- Instances ------
panel.add(new InstancesPanel(component, order), "span, grow, wrap para");
primary.add(panel, "grow, gapright 40lp"); primary.add(panel, "grow, gapright 40lp");