hitTestDots method
Returns the index of the section that contains dx
.
Sections or hit-targets are calculated differently in some effects
Implementation
@override
int hitTestDots(double dx, int count, double current) {
var anchor = -spacing / 2;
for (var index = 0; index < count; index++) {
var widthBound =
(index == current ? (dotWidth * expansionFactor) : dotWidth) +
spacing;
if (dx <= (anchor += widthBound)) {
return index;
}
}
return -1;
}