mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 10:30:44 +01:00
better tab outline width
This commit is contained in:
@@ -57,6 +57,7 @@ public class TabOutline {
|
||||
|
||||
int minWidth = (int) (editor.getMinimumSize().width * 0.7f), maxWidth = (int) (editor
|
||||
.getMinimumSize().width * 0.9f);
|
||||
minWidth = Math.min(minWidth, estimateFrameWidth());
|
||||
frmOutlineView.setLayout(new BoxLayout(frmOutlineView.getContentPane(),
|
||||
BoxLayout.Y_AXIS));
|
||||
JPanel panelTop = new JPanel(), panelBottom = new JPanel();
|
||||
@@ -278,6 +279,15 @@ public class TabOutline {
|
||||
return found;
|
||||
}
|
||||
|
||||
private int estimateFrameWidth() {
|
||||
int w = 100;
|
||||
for (int i = 0; i < editor.getSketch().getCodeCount(); i++) {
|
||||
w = Math.max(w,
|
||||
editor.getSketch().getCode(i).getPrettyName().length() * 10);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
private int estimateFrameHeight(){
|
||||
// Assuming each tree node height to be 25 pixels
|
||||
return Math.min(20 * (editor.getSketch().getCodeCount() + 1),
|
||||
|
||||
Reference in New Issue
Block a user