positionFractionFromTrackDy static method
Map pointer Y on the track to positionFraction (NOT inverted).
Uses thumb-leading-edge in the usable range — same as GtkRange mapping
value = thumb_leading / usable * max_value.
Implementation
static double positionFractionFromTrackDy({
required double localDy,
required double trackHeight,
required double thumbHeight,
}) {
final usable = trackHeight - thumbHeight;
if (usable <= 0) return 1.0;
final leading = (localDy - thumbHeight / 2).clamp(0.0, usable);
return (leading / usable).clamp(0.0, 1.0);
}