Merge pull request from JoePfeiffer/fix-527

Fix 
This commit is contained in:
Wes Cravens 2019-04-10 10:47:26 -05:00 committed by GitHub
commit ef08041802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 24 deletions
core/src/net/sf/openrocket/rocketcomponent

@ -249,23 +249,28 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
} }
/** /**
* Set the height from the fin's base at the reference point -- i.e. where the tab is located from. If the tab is located via BOTTOM, then the back edge will be * Set the height from the fin's base at the reference point --
* <code>height</code> deep, and the bottom edge of the tab will be parallel to the stage centerline. If the tab is located via TOP, the the front edge will have corresponding height/depth. * i.e. where the tab is located from. If the tab is located via
* BOTTOM, then the back edge will be <code>height</code> deep,
* and the bottom edge of the tab will be parallel to the stage
* centerline. If the tab is located via TOP, the the front edge
* will have corresponding height/depth.
* If the tab is located via MIDDLE, the tab's midpoint is used. * If the tab is located via MIDDLE, the tab's midpoint is used.
* *
* Note this function also does bounds checking, and will not set a tab height that passes through it's parent's midpoint. * Note this function also does bounds checking, and will not set
* a tab height that passes through it's parent's midpoint.
* *
* @param newHeightRequest how deep the fin tab should project from the fin root, at the reference point * @param newHeightRequest how deep the fin tab should project
* from the fin root, at the reference point
* *
*/ */
public void setTabHeight(final double newHeightRequest) { public void setTabHeight(final double heightRequest) {
if (MathUtil.equals(this.tabHeight, MathUtil.max(newHeightRequest, 0))){ if (MathUtil.equals(this.tabHeight, MathUtil.max(heightRequest, 0))){
return; return;
} }
this.tabHeight = newHeightRequest; tabHeight = heightRequest;
validateFinTab();
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
} }
@ -274,25 +279,29 @@ public abstract class FinSet extends ExternalComponent implements RingInstanceab
return tabLength; return tabLength;
} }
public void setTabLength(double length) { /**
length = MathUtil.max(length, 0); * set tab length
if (MathUtil.equals(this.tabLength, length)) */
public void setTabLength(final double lengthRequest) {
if (MathUtil.equals(tabLength, MathUtil.max(lengthRequest, 0))) {
return; return;
tabLength = length; }
validateFinTab();
tabLength = lengthRequest;
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
} }
/** /**
* internally, set the internal * internally, set the internal offset and optionally validate tab
* *
* @param newOffset new requested shift of tab -- from * @param offsetRequest new requested shift of tab -- from
* @param validate wehther or not to validate
*/ */
public void setTabOffset( final double newOffset) { public void setTabOffset( final double offsetRequest) {
this.tabOffset = newOffset; tabOffset = offsetRequest;
this.tabPosition = this.tabOffsetMethod.getAsPosition( newOffset, this.tabLength, this.length); tabPosition = tabOffsetMethod.getAsPosition( tabOffset, tabLength, length);
validateFinTab();
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
} }