increased the free space at the edges at auto-fit, closes #300

This commit is contained in:
hneemann 2019-08-12 10:03:49 +02:00
parent 350916d1db
commit cbe8af910c
2 changed files with 9 additions and 2 deletions

View File

@ -937,8 +937,9 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
AffineTransform newTrans = new AffineTransform();
if (gr.getMin() != null && getWidth() != 0 && getHeight() != 0) {
Vector delta = gr.getMax().sub(gr.getMin());
double sx = ((double) getWidth()) / (delta.x + Style.NORMAL.getThickness() * 4);
double sy = ((double) getHeight()) / (delta.y + Style.NORMAL.getThickness() * 6);
int pad = circuitScrollPanel.getBarWidth();
double sx = ((double) getWidth() - pad) / (delta.x + SIZE * 2);
double sy = ((double) getHeight() - pad) / (delta.y + SIZE * 2);
double s = Math.min(sx, sy);

View File

@ -117,4 +117,10 @@ public class CircuitScrollPanel extends JPanel {
bar.setVisible(viewMin > circuitMin || viewMax < circuitMax);
}
/**
* @return the width of the bars
*/
int getBarWidth() {
return vertical.getPreferredSize().width;
}
}