Skip to content

Commit

Permalink
Fix SizeTracker horizontal resize (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugen authored Aug 5, 2020
1 parent 760ee09 commit 0d0ed41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/fxmisc/flowless/SizeTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public SizeTracker(
viewportBounds,
(a, b) -> Math.max(a, orientation.breadth(b)));

Val<Function<Cell<?, ?>, Double>> lengthFn = avoidFalseInvalidations(breadthForCells).map(
breadth -> cell -> orientation.prefLength(cell, breadth));
Val<Function<Cell<?, ?>, Double>> lengthFn;
lengthFn = (orientation instanceof HorizontalHelper ? breadthForCells : avoidFalseInvalidations(breadthForCells))
.map(breadth -> cell -> orientation.prefLength(cell, breadth));

this.lengths = cells.mapDynamic(lengthFn).memoize();

Expand Down Expand Up @@ -193,4 +194,4 @@ public double lengthFor(int itemIndex) {
public double getCellLayoutBreadth() {
return breadthForCells.getValue();
}
}
}

0 comments on commit 0d0ed41

Please sign in to comment.