Skip to content

Excessive scene layout updates when scrolling horizontally #1288

@Col-E

Description

@Col-E

I have these two videos. The first is the existing behavior observed on the latest release of RichTextFX:

V7La6Gz3og.mp4

Things to note:

  • Scrolling vertically is fine and presents no issue
  • Scrolling horizontally triggers excessive scene layout updates which causes the application to visually stutter (the many layout updates block the UI thread)

I created a "hack" to address this. The hack is simple. In ParagraphBox I removed graphicOffset.addListener(obs -> requestLayout());. This is not a viable solution, but it illustrates something important, the horizontal scrolling is now very smooth.

kWG5oHWKD9.mp4

However the problem with this "hack" is that now that the x coordinate of the graphic is no longer used to fix paragraph layout updates you can get funky incorrect layouts like this:

Image

I think there is something to be done here with reducing the level of work the FX thread has to do, as without this hack everything between the ParagraphBox and the scene root (unless you have an unmanaged node in the chain) gets invalidated and must be laid out again and again every frame while scrolling horizontally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions