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 dotWidth = dotDecoration.width + dotDecoration.dotBorder.neededSpace;
if (index == current) {
dotWidth = activeDotDecoration.width +
activeDotDecoration.dotBorder.neededSpace;
}
var widthBound = dotWidth + spacing;
if (dx <= (anchor += widthBound)) {
return index;
}
}
return -1;
}