minor fix

This commit is contained in:
Thibault Deckers 2022-11-15 12:44:12 +01:00
parent 126059ee48
commit 7cc663748a

View file

@ -77,16 +77,16 @@ class TileExtentController {
double _extentForColumnCount(int columnCount) => (viewportSize.width - (horizontalPadding * 2) - spacing * (columnCount - 1)) / columnCount; double _extentForColumnCount(int columnCount) => (viewportSize.width - (horizontalPadding * 2) - spacing * (columnCount - 1)) / columnCount;
int _effectiveColumnCountMin() => _columnCountForExtent(_extentMax()).ceil(); int _effectiveColumnCountMin() => max(columnCountMin, _columnCountForExtent(_extentMax()).ceil());
int _effectiveColumnCountMax() => _columnCountForExtent(extentMin).floor(); int _effectiveColumnCountMax() => max(columnCountMin, _columnCountForExtent(extentMin).floor());
int _effectiveColumnCountForExtent(double extent) { int _effectiveColumnCountForExtent(double extent) {
if (extent > 0) { if (extent > 0) {
final columnCount = _columnCountForExtent(extent); final columnCount = _columnCountForExtent(extent);
final countMin = _effectiveColumnCountMin(); final countMin = _effectiveColumnCountMin();
final countMax = _effectiveColumnCountMax(); final countMax = _effectiveColumnCountMax();
return columnCount.clamp(countMin, max(countMin, countMax)).round(); return columnCount.round().clamp(countMin, countMax);
} }
return columnCountDefault; return columnCountDefault;
} }