mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-169924 constant gap between breadcrumbs
This commit is contained in:
@@ -339,6 +339,10 @@ public class Breadcrumbs extends JComponent implements RegionPainter<Crumb> {
|
||||
return insets;
|
||||
}
|
||||
|
||||
private static int getGap(Component component) {
|
||||
return 10 * getScale(component);
|
||||
}
|
||||
|
||||
private static int getScale(Component component) {
|
||||
return component == null ? 1 : getScale(component.getFont());
|
||||
}
|
||||
@@ -366,7 +370,9 @@ public class Breadcrumbs extends JComponent implements RegionPainter<Crumb> {
|
||||
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container container) {
|
||||
Dimension size = getPreferredSize(getComponents(container, Breadcrumbs::toVisible));
|
||||
ArrayList<Component> components = getComponents(container, Breadcrumbs::toVisible);
|
||||
Dimension size = getPreferredSize(components);
|
||||
size.width += components.size() * getGap(container);
|
||||
if (size.height == 0) size.height = getPreferredHeight(container);
|
||||
JBInsets.addTo(size, container.getInsets());
|
||||
return size;
|
||||
@@ -387,7 +393,7 @@ public class Breadcrumbs extends JComponent implements RegionPainter<Crumb> {
|
||||
else /*if (bounds.width < size.width) {
|
||||
}
|
||||
else*/ {
|
||||
int gap = Math.max(0, Math.min(10 * getScale(container), (bounds.width - size.width) / (count - 1)));
|
||||
int gap = getGap(container);
|
||||
for (Component component : components) {
|
||||
Dimension preferred = component.getPreferredSize();
|
||||
component.setBounds(bounds.x, bounds.y, preferred.width, bounds.height);
|
||||
|
||||
Reference in New Issue
Block a user