labelsOverlap method
Only should be called after layout
Identifying overlap is crucial in labels auto-layout.
Notes:
-
_xGridStep
is a limit for each label container width in the X direction. -
Labels are layed out evenly, so if any label container's layoutSize in the X direction overflows the
_xGridStep
, labels containers DO overlap. In such situation, the caller should take action to make labels smaller, tilt, or skip.
Implementation
@override
bool labelsOverlap() {
if (_xLabelContainers.any((axisLabelContainer) =>
!axisLabelContainer.skipByParent && axisLabelContainer.layoutSize.width > _shownLabelsStepWidth)) {
return true;
}
return false;
}