@@ -95,9 +95,6 @@ public final ObservableMap<Selection<PS, SEG, S>, SelectionPath> selectionsPrope
9595 this .text = new ParagraphText <>(par , nodeFactory );
9696 applyParagraphStyle .accept (this .text , par .getParagraphStyle ());
9797
98- // Apply line-spacing (in a paragraph) to between paragraphs as well. Can be overriden with -fx-padding CSS.
99- text .lineSpacingProperty ().addListener ( (ob ,ov ,nv ) -> setPadding ( new Insets ( 0 , 0 , nv .doubleValue (), 0 ) ) );
100-
10198 // start at -1 so that the first time it is displayed, the caret at pos 0 is not
10299 // accidentally removed from its parent and moved to this node's ParagraphText
103100 // before this node gets updated to its real index and therefore removes
@@ -240,21 +237,20 @@ protected double computePrefWidth(double ignoredHeight) {
240237 protected double computePrefHeight (double width ) {
241238 Insets insets = getInsets ();
242239 double overhead = getGraphicPrefWidth () + insets .getLeft () + insets .getRight ();
243- return text .prefHeight (width - overhead ) + insets .getTop () + insets .getBottom ();
240+ return text .prefHeight (width - overhead ) + insets .getTop () + insets .getBottom () + text . getLineSpacing () ;
244241 }
245242
246243 @ Override
247- protected
248- void layoutChildren () {
244+ protected void layoutChildren () {
249245 Insets ins = getInsets ();
250246 double w = getWidth () - ins .getLeft () - ins .getRight ();
251247 double h = getHeight () - ins .getTop () - ins .getBottom ();
252248 double graphicWidth = getGraphicPrefWidth ();
249+ double half = text .getLineSpacing () / 2.0 ;
253250
254- text .resizeRelocate (graphicWidth + ins .getLeft (), ins .getTop (), w - graphicWidth , h );
251+ text .resizeRelocate (graphicWidth + ins .getLeft (), ins .getTop () + half , w - graphicWidth , h - half );
255252
256- graphic .ifPresent (g -> g .resizeRelocate (graphicOffset .get () + ins .getLeft (), ins .getTop (), graphicWidth , h + ins .getBottom ()));
257- // h + ins.getBottom() so that there aren't gaps when -fx-line-spacing or -fx-padding is active.
253+ graphic .ifPresent (g -> g .resizeRelocate (graphicOffset .get () + ins .getLeft (), ins .getTop (), graphicWidth , h ));
258254 }
259255
260256 double getGraphicPrefWidth () {
0 commit comments