Merge pull request #2041 from SiboVG/issue-2035

[#2035] Add instances setting in launch lug config
This commit is contained in:
Sibo Van Gool 2023-02-14 03:05:13 +00:00 committed by GitHub
commit 65903bd88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View File

@ -33,6 +33,7 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
radius = 0.01 / 2;
thickness = 0.001;
length = 0.03;
this.setInstanceSeparation(this.length * 2);
super.displayOrder_side = 15; // Order for displaying the component in the 2D side view
super.displayOrder_back = 12; // Order for displaying the component in the 2D back view
}
@ -274,7 +275,11 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
}
}
if (MathUtil.equals(this.instanceSeparation, _separation)) {
return;
}
this.instanceSeparation = _separation;
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
}
@Override
@ -285,9 +290,11 @@ public class LaunchLug extends Tube implements AnglePositionable, BoxBounded, Li
}
}
if( 0 < newCount ){
this.instanceCount = newCount;
if (newCount == this.instanceCount || newCount <= 0) {
return;
}
this.instanceCount = newCount;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@Override

View File

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

View File

@ -92,7 +92,10 @@ public class LaunchLugConfig extends RocketComponentConfig {
order.add(((SpinnerEditor) spin.getEditor()).getTextField());
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");