From b95ab739b0578f28b6f3e52d7f4cd30ae6d82133 Mon Sep 17 00:00:00 2001 From: Jurgen Date: Mon, 13 Jun 2022 13:34:19 +0200 Subject: [PATCH] Update OrientationHelper.java --- src/main/java/org/fxmisc/flowless/OrientationHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/fxmisc/flowless/OrientationHelper.java b/src/main/java/org/fxmisc/flowless/OrientationHelper.java index 7d5d0fa..a55e5de 100644 --- a/src/main/java/org/fxmisc/flowless/OrientationHelper.java +++ b/src/main/java/org/fxmisc/flowless/OrientationHelper.java @@ -1,9 +1,11 @@ package org.fxmisc.flowless; +import javafx.application.Platform; import javafx.beans.property.DoubleProperty; import javafx.geometry.Bounds; import javafx.geometry.Orientation; import javafx.scene.Node; +import javafx.scene.Parent; import org.reactfx.value.Val; import org.reactfx.value.Var; @@ -259,6 +261,10 @@ public double prefBreadth(Node node) { @Override public double prefLength(Node node, double breadth) { + if ( node.getScene() == null && node instanceof Parent ) { + Platform.runLater( () -> ((Parent) node).requestLayout() ); + // Need to redo this as prefHeight maybe incorrect + } return node.prefHeight(breadth); }