[fixes #436] Rocket figures now center as desired.
This commit is contained in:
parent
c971978b02
commit
10a0cabd98
@ -466,16 +466,18 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void updateCanvasOrigin() {
|
protected void updateCanvasOrigin() {
|
||||||
|
final int subjectWidth = (int)(subjectBounds_m.getWidth()*scale);
|
||||||
|
final int subjectHeight = (int)(subjectBounds_m.getHeight()*scale);
|
||||||
|
|
||||||
final Dimension subjectArea = new Dimension((int)(subjectBounds_m.getWidth()*scale),
|
|
||||||
(int)(subjectBounds_m.getHeight()*scale));
|
|
||||||
|
|
||||||
final int newOriginY = borderThickness_px.height + (int)(subjectArea.getHeight() / 2);
|
|
||||||
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
||||||
int newOriginX = borderThickness_px.width + getWidth() / 2;
|
final int newOriginX = borderThickness_px.width + Math.max(getWidth(), subjectWidth + 2*borderThickness_px.width)/ 2;
|
||||||
|
final int newOriginY = borderThickness_px.height + getHeight() / 2;
|
||||||
|
|
||||||
originLocation_px = new Dimension(newOriginX, newOriginY);
|
originLocation_px = new Dimension(newOriginX, newOriginY);
|
||||||
}else {
|
}else if (currentViewType == RocketPanel.VIEW_TYPE.SideView){
|
||||||
int newOriginX = borderThickness_px.width + (getWidth() - subjectArea.width) / 2;
|
final int newOriginX = borderThickness_px.width;
|
||||||
|
final int newOriginY = Math.max(getHeight(), subjectHeight + 2*borderThickness_px.height )/ 2;
|
||||||
|
|
||||||
originLocation_px = new Dimension(newOriginX, newOriginY);
|
originLocation_px = new Dimension(newOriginX, newOriginY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user