diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/skin/ParagraphBox.java b/richtextfx/src/main/java/org/fxmisc/richtext/skin/ParagraphBox.java index 823f08aa6..ce60dcef2 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/skin/ParagraphBox.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/skin/ParagraphBox.java @@ -71,9 +71,6 @@ public ParagraphBox(int index, Paragraph par, BiConsumer applyStyle) getChildren().add(newG); } }); - boundsInParentProperty().addListener((obs, old, bounds) -> { - graphic.ifPresent(g -> g.relocate(-bounds.getMinX(), 0)); - }); } public Property caretVisibleProperty() { return text.caretVisibleProperty(); } @@ -157,11 +154,12 @@ void layoutChildren() { Bounds bounds = getLayoutBounds(); double w = bounds.getWidth(); double h = bounds.getHeight(); + double layoutX = getLayoutX(); double graphicWidth = getGraphicWidth(); text.resizeRelocate(graphicWidth, 0, w - graphicWidth, h); graphic.ifPresent(g -> { - g.resize(graphicWidth, h); + g.resizeRelocate(-layoutX, 0, graphicWidth, h); }); }