This commit is contained in:
crschnick
2026-08-12 06:31:46 +00:00
parent 3d74ef4fa9
commit eefd2f6c06
6 changed files with 22 additions and 13 deletions
@@ -44,6 +44,9 @@ public class ListBoxViewComp<T> extends RegionBuilder<ScrollPane> {
@Setter
private boolean visibilityControl = false;
@Setter
private boolean fixScrollReset = false;
public ListBoxViewComp(
ObservableList<T> shown,
ObservableList<T> all,
@@ -135,17 +138,20 @@ public class ListBoxViewComp<T> extends RegionBuilder<ScrollPane> {
}
};
scroll.vvalueProperty().addListener((observable, oldValue, newValue) -> {
// Fix scrollbar resetting on fast scroll
// If one node within has focus and moves out of focus fast,
// the scrollbar will try to focus another one and move it into view
// This can result in flicker when scrolling fast enough
var hasWindowFocus = scroll.getScene().getWindow().isFocused();
if (scroll.isFocusWithin() || !hasWindowFocus) {
scroll.requestFocus();
}
dirty.set(true);
});
if (fixScrollReset) {
scroll.vvalueProperty().addListener((observable, oldValue, newValue) -> {
// Fix scrollbar resetting on fast scroll
// If one node within has focus and moves out of focus fast,
// the scrollbar will try to focus another one and move it into view
// This can result in flicker when scrolling fast enough
var hasWindowFocus = scroll.getScene().getWindow().isFocused();
if (scroll.isFocusWithin() || !hasWindowFocus) {
scroll.requestFocus();
}
dirty.set(true);
});
}
scroll.heightProperty().addListener((observable, oldValue, newValue) -> {
dirty.set(true);
});
@@ -211,6 +211,7 @@ public class StoreCategoryComp extends SimpleRegionBuilder {
children.style("children");
children.minHeight(0);
children.setVisibilityControl(true);
children.setFixScrollReset(true);
var hide = Bindings.createBooleanBinding(
() -> {
@@ -52,6 +52,7 @@ public class StoreEntryListComp extends SimpleRegionBuilder {
},
true);
content.setVisibilityControl(true);
content.setFixScrollReset(true);
content.apply(struc -> {
// Reset scroll
StoreViewState.get().getActiveCategory().addListener((observable, oldValue, newValue) -> {
@@ -156,6 +156,7 @@ public abstract class StoreSectionBaseComp extends RegionBuilder<VBox> {
function,
section.getWrapper() == null);
content.setVisibilityControl(true);
content.setFixScrollReset(true);
content.minHeight(0);
content.hgrow();
content.style("children-content");
@@ -36,7 +36,7 @@
}
.root:light .category:recursive:selected {
-fx-background-color: -color-border-default, derive(-color-bg-default, 10%);
-fx-background-color: derive(-color-border-default, -20%), derive(-color-bg-default, 10%);
-fx-background-insets: 0, 1;
-fx-background-radius: 4px;
-fx-border-radius: 4px;
@@ -15,7 +15,7 @@
}
.root:pretty:dark .color-box.gray {
-fx-background-color: linear-gradient(from 100% 0% to 0% 100%, derive(-color-bg-default, 5%) 40%, derive(-color-bg-default, 1%) 50%, derive(-color-bg-default, 5%) 100%);
-fx-background-color: linear-gradient(from 100% 0% to 0% 100%, derive(-color-bg-default, 10%) 40%, derive(-color-bg-default, 6%) 50%, derive(-color-bg-default, 10%) 100%);
-fx-border-color: -color-border-default;
}