Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TextFlowExt extends TextFlow {
private TextFlowLayout textLayout()
{
if ( layout == null ) {
layout = new TextFlowLayout( this, getManagedChildren() );
layout = new TextFlowLayout( this );
}
return layout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
class TextFlowLayout
{
private TextFlow flow;
private List<Node> children;
private List<TextFlowSpan> lineMetrics = new ArrayList<>();
private int lineCount = -1;

TextFlowLayout( TextFlow tf, List<Node> managedChildren ) {
TextFlowLayout( TextFlow tf ) {
tf.getChildren().addListener( (Observable ob) -> lineCount = -1 );
tf.widthProperty().addListener( (Observable ob) -> lineCount = -1 );
children = managedChildren;
flow = tf;
}

Expand Down Expand Up @@ -73,7 +71,7 @@ int getLineCount() {
double totLines = 0.0, prevMinY = 1.0, prevMaxY = -1.0;
int totCharSoFar = 0;

for ( Node n : children ) {
for ( Node n : flow.getChildren() ) if ( n.isManaged() ) {

Bounds nodeBounds = n.getBoundsInParent();
int length = (n instanceof Text) ? ((Text) n).getText().length() : 1;
Expand Down