JavaFX snapping and scale

Marius Hanl mariushanl at
Mon Sep 27 09:41:40 UTC 2021

   I recently tried to fix "TableView: visual glitch at borders on
   horizontal scrolling".
   Ticket: [1]
   PR: [2]

   As also written in the PR I have problems understanding the
   snapping/scaling of JavaFX.
   Here in short what I found out:
   - Snapping fixed the issue for a scale of 1 or 2, but not for a scale
   like 1.25 or 1.5
   --- Also VirtualFlow is the only occurence where we set the layoutX of
   a clip (might be the problem?)
   - This visual glitch only happens sometimes when the x value is a
   decimal number, e.g. 12.66 (never when it's a round number like 13)
   - Math.round(..) or a cast to int fixed this (for all scales), but is
   probably not the correct solution or maybe only fixing a symptom here

   Which leads to my question where may some of you can help me:
   - How does JavaFX renders a node when e.g. x is a decimal number? How
   many pixel are used then?
   - And does a decimal number make sense (Why we e.g. don't round the
   value), which looks like it works fine and doesn't result in visual

   Also information/insights about fixes made in the past which relates
   with this are welcome.
   I saw that there were quite some issues with a scale other then 1 in
   the past.

   Note: If the result is that everything works as expected chances are
   there might a generic problem with snapping/layout/rendering somewhere
   Any information are welcome and feel free to also have a look at the

   -- Marius



More information about the openjfx-dev mailing list