Skip to content

Commit

Permalink
Fixed incorrect use of getManagedChildren (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen authored Dec 31, 2019
1 parent a227e06 commit 725f9d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
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

0 comments on commit 725f9d0

Please sign in to comment.