RFR: 8311527: Region.snapInnerSpace*()
Kevin Rushforth
kcr at openjdk.org
Thu Aug 17 19:17:56 UTC 2023
On Sat, 29 Jul 2023 00:12:45 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> Introduces Region.snapInnerSpaceX/Y() methods for dealing with inner space (using Math.floor), see for instance [JDK-8299753](https://bugs.openjdk.org/browse/JDK-8299753), using existing methods Region.snapPortionX/Y().
I see this in the two new snap methods:
> For negative values returns 0.0.
Clamping to zero is not something any of the other snap methods do, and would be unexpected for a general purpose method such as this. If your use case really does require clamping to 0 (does it?), that should either be done by the caller, or it will need a name that implies clamping (e.g., has "clamp" or "positive" or similar in the name).
So the first question to answer is whether this really needs to clamp to zero?
Possibly worth noting is that this new method is similar to the existing private method `snapPortion`, but with a clamp to 0. I don't know if that might help inform the name (since it is non-public, it might not).
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1190#issuecomment-1656744168
More information about the openjfx-dev
mailing list