[fix] ff fin autozoom now works on tail transitions

This commit is contained in:
Daniel_M_Williams 2020-07-11 17:14:24 -04:00
parent 9890c33ef5
commit 8162e81ac0
3 changed files with 36 additions and 6 deletions

View File

@ -89,10 +89,14 @@ public abstract class AbstractScaleFigure extends JPanel {
return originLocation_px; return originLocation_px;
} }
public Point getAutoZoomPoint(){ /**
return new Point(Math.max(0, originLocation_px.x - borderThickness_px.width), * Calculate a point for auto-zooming from a scale-to-fit request.
Math.max(0, - borderThickness_px.height)); *
} * The return point is intended for a $ScaleScrollPane call to "viewport.scrollRectToVisible(...)"
*
* @return the offset, in pixels, from the (top left) corner of the figure's canvas
*/
public abstract Point getAutoZoomPoint();
/** /**
* Set the scale level of the figure. A scale value of 1.0 is equivalent to 100 % scale. * Set the scale level of the figure. A scale value of 1.0 is equivalent to 100 % scale.

View File

@ -71,6 +71,24 @@ public class FinPointFigure extends AbstractScaleFigure {
updateFigure(); updateFigure();
} }
@Override
public Point getAutoZoomPoint(){
final int finFrontLocationPx = originLocation_px.x + (int)(subjectBounds_m.getX()*scale);
// from canvas top/left
final Point zoomPointPx = new Point( Math.max(0, originLocation_px.x + (int)(subjectBounds_m.getX()*scale)),
0 );
System.err.println("==>> FinPointFigure.getAutoZoomPoint ==>> " + finset.getName() );
System.err.println(String.format(" ::ContentBounds: %6.4f, %6.4f", contentBounds_m.getX(), contentBounds_m.getY()));
System.err.println(String.format(" ::SubjectBounds: %6.4f, %6.4f", subjectBounds_m.getX(), subjectBounds_m.getY()));
// System.err.println(String.format(" ::finRootOffset: %d, %d", finFrontOffsetPx, finBottomOffsetPx));
// System.err.println(String.format(" ::finRootLocation: %d, %d", finFrontLocationPx, 0));
System.err.println(String.format(" ::ZoomPoint: %d, %d", zoomPointPx.x, zoomPointPx.y));
return zoomPointPx;
}
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
@ -378,8 +396,11 @@ public class FinPointFigure extends AbstractScaleFigure {
@Override @Override
protected void updateCanvasOrigin() { protected void updateCanvasOrigin() {
final int finHeightPx = (int)(finBounds_m.span().y*scale); final int finHeightPx = (int)(finBounds_m.max.y*scale);
final int mountHeightPx = (int)(mountBounds_m.span().y*scale); final int mountHeightPx = (int)(mountBounds_m.span().y*scale);
// this is non-intuitive: it's an offset _from_ the origin(0,0) _to_ the lower-left of the content --
// because the canvas is drawn from that lower-left corner of the content, and the fin-front
// is fixed-- by definition-- to the origin.
final int finFrontPx = (int)(contentBounds_m.getX()*scale); final int finFrontPx = (int)(contentBounds_m.getX()*scale);
final int contentHeightPx = (int)(contentBounds_m.getHeight()*scale); final int contentHeightPx = (int)(contentBounds_m.getHeight()*scale);

View File

@ -89,7 +89,12 @@ public class RocketFigure extends AbstractScaleFigure {
updateFigure(); updateFigure();
} }
public Point getAutoZoomPoint(){
return new Point( Math.max(0, originLocation_px.x - borderThickness_px.width),
Math.max(0, - borderThickness_px.height));
}
public RocketComponent[] getSelection() { public RocketComponent[] getSelection() {
return selection; return selection;
} }