Browse Source

Windows: Add missing arc property for lists on Windows 11

pull/336/head
Jannis Weis 2 years ago
parent
commit
bb6bbe112a
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java
  2. 17
      core/src/main/java/com/github/weisj/darklaf/ui/util/DarkUIUtil.java

3
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java

@ -156,7 +156,8 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener, C
arc = UIManager.getInt("Tree.selection.arc");
selectionMargin = UIManager.getInsets("Tree.selection.margin");
if (selectionMargin != null) {
PropertyUtil.installBorder(tree, new BorderUIResource.EmptyBorderUIResource(selectionMargin));
PropertyUtil.installBorder(tree,
new BorderUIResource.EmptyBorderUIResource(DarkUIUtil.scale(selectionMargin, 0.5f, null)));
}
}

17
core/src/main/java/com/github/weisj/darklaf/ui/util/DarkUIUtil.java

@ -98,13 +98,18 @@ public final class DarkUIUtil {
return scale(ins, -1);
}
public static Insets scale(final Insets ins, final int factor) {
public static Insets scale(final Insets ins, final float factor) {
return scale(ins, factor, ins);
}
public static Insets scale(final Insets ins, final float factor, final Insets out) {
if (ins == null) return null;
ins.left *= factor;
ins.right *= factor;
ins.top *= factor;
ins.bottom *= factor;
return ins;
Insets result = out != null ? out : new Insets(0, 0, 0, 0);
result.left = (int) (ins.left * factor);
result.right = (int) (ins.right * factor);
result.top = (int) (ins.top * factor);
result.bottom = (int) (ins.bottom * factor);
return result;
}
public static Insets addInsets(final Insets ins1, final Insets ins2) {

Loading…
Cancel
Save