> - Make it clear which values are snapped, raw or near-snapped by using > prefixes "raw", "snapped" and "near" in variables and method names. > Much of the code incorrectly assumes that adding, subtracting or > multiplying two snapped values results in a snapped value. This is not > true, it is only a nearly snapped value; it must be resnapped if > returned. By meticulously tracking what is snapped, almost snapped and > raw it is easier to call snap functions only when needed. This is > mostly renaming of variables. There are numerous small problems in > these classes (and probably other classes) where values are not > resnapped after floating point calculations.
It is incredible easy to get this wrong. I'd appreciate a "how to snap correctly" tutorial/documentation somewhere in JavaFX.