[fix] RocketFigure now zooms to whole rocket extents even iff stages are deactivated
This commit is contained in:
parent
b9992674ef
commit
58712cb69f
@ -546,6 +546,10 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
// if (rocket.getModID() != boundsModID) {
|
// if (rocket.getModID() != boundsModID) {
|
||||||
calculateBounds();
|
calculateBounds();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if(cachedBounds.isEmpty())
|
||||||
|
cachedBounds = new BoundingBox(Coordinate.ZERO,Coordinate.X_UNIT);
|
||||||
|
|
||||||
return cachedBounds;
|
return cachedBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,9 +423,11 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateSubjectDimensions() {
|
protected void updateSubjectDimensions() {
|
||||||
// calculate bounds, and store in class variables
|
// calculate bounds, and store in class variables
|
||||||
BoundingBox newBounds = rocket.getSelectedConfiguration().getBoundingBox();
|
|
||||||
if(newBounds.isEmpty())
|
final FlightConfiguration config = rocket.getSelectedConfiguration().clone();
|
||||||
newBounds = new BoundingBox(Coordinate.ZERO,Coordinate.X_UNIT);
|
// Explicitly zoom & draw at a scale to fit the entire rocket, but only show the selected stages.
|
||||||
|
config.setAllStages();
|
||||||
|
final BoundingBox newBounds = config.getBoundingBox();
|
||||||
|
|
||||||
final double maxR = Math.max( Math.hypot(newBounds.min.y, newBounds.min.z),
|
final double maxR = Math.max( Math.hypot(newBounds.min.y, newBounds.min.z),
|
||||||
Math.hypot(newBounds.max.y, newBounds.max.z));
|
Math.hypot(newBounds.max.y, newBounds.max.z));
|
||||||
@ -451,19 +453,19 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateCanvasOrigin() {
|
protected void updateCanvasOrigin() {
|
||||||
final int subjectWidth = (int)(subjectBounds_m.getWidth()*scale);
|
final int subjectWidth = (int)(subjectBounds_m.getWidth()*scale);
|
||||||
final int subjectHeight = (int)(subjectBounds_m.getHeight()*scale);
|
final int subjectHeight = (int)(subjectBounds_m.getHeight()*scale);
|
||||||
final int mid_x = (Math.max(getWidth(), subjectWidth) / 2);
|
final int mid_x = (Math.max(getWidth(), subjectWidth) / 2);
|
||||||
|
|
||||||
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
||||||
final int newOriginX = mid_x;
|
final int newOriginX = mid_x;
|
||||||
final int newOriginY = borderThickness_px.height + getHeight() / 2;
|
final int newOriginY = borderThickness_px.height + getHeight() / 2;
|
||||||
|
|
||||||
originLocation_px = new Point(newOriginX, newOriginY);
|
originLocation_px = new Point(newOriginX, newOriginY);
|
||||||
}else if (currentViewType == RocketPanel.VIEW_TYPE.SideView){
|
}else if (currentViewType == RocketPanel.VIEW_TYPE.SideView){
|
||||||
final int newOriginX = mid_x - (int) ((subjectBounds_m.getWidth() * scale) / 2);
|
final int newOriginX = mid_x - (subjectWidth / 2);
|
||||||
final int newOriginY = Math.max(getHeight(), subjectHeight + 2*borderThickness_px.height )/ 2;
|
final int newOriginY = Math.max(getHeight(), subjectHeight + 2*borderThickness_px.height )/ 2;
|
||||||
originLocation_px = new Point(newOriginX, newOriginY);
|
originLocation_px = new Point(newOriginX, newOriginY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user