Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed JFXChipView can not be scrolled when chip filled one*n row #1236

Open
wants to merge 1 commit into
base: JFoenix-9.0.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions jfoenix/src/main/java/com/jfoenix/skins/JFXChipViewSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import javafx.util.StringConverter;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
* JFXChipArea is the material design implementation of chip Input.
Expand All @@ -73,6 +74,7 @@ public class JFXChipViewSkin<T> extends SkinBase<JFXChipView<T>> {
private boolean editorOnNewLine = true;
private double availableWidth;
private double requiredWidth;
private final AtomicInteger mMangedChildrenSize = new AtomicInteger(0);

private final ListChangeListener<T> chipsChangeListeners = change -> {
while (change.next()) {
Expand Down Expand Up @@ -135,7 +137,7 @@ public void requestFocus() {
createChip(item);
}
control.getChips().addListener(new WeakListChangeListener<>(chipsChangeListeners));

}

@Override
Expand Down Expand Up @@ -223,7 +225,7 @@ private void setupEditor() {
autoCompletePopup.show(editor);
}
});

editor.promptTextProperty().bind(control.promptTextProperty());
root.getChildren().add(editor);

Expand Down Expand Up @@ -338,6 +340,8 @@ public void updateEditorPosition() {
final List<Node> managedChildren = getManagedChildren();
final int mangedChildrenSize = managedChildren.size();
if (mangedChildrenSize > 0) {
if (mMangedChildrenSize.get() == mangedChildrenSize) return;
mMangedChildrenSize.set(mangedChildrenSize);
Region lastChild = (Region) managedChildren.get(mangedChildrenSize - 1);
double contentHeight = lastChild.getHeight() + lastChild.getLayoutY();
availableWidth = insideWidth - lastChild.getBoundsInParent().getMaxX();
Expand Down