File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,13 +6,21 @@ class FixedAnimation extends BadgeAnimation {
66 List <List <bool >> processGrid, List <List <bool >> canvas) {
77 int newGridHeight = processGrid.length;
88 int newGridWidth = processGrid[0 ].length;
9- const int startCol = 0 ;
9+
10+ int horizontalOffset = 0 ;
11+ if (newGridWidth < badgeWidth) {
12+ horizontalOffset = (badgeWidth - newGridWidth) ~ / 2 ;
13+ }
1014
1115 for (int i = 0 ; i < badgeHeight; i++ ) {
1216 for (int j = 0 ; j < badgeWidth; j++ ) {
13- bool isNewGridCell = i < newGridHeight && (startCol + j) < newGridWidth;
17+ int sourceCol = j - horizontalOffset;
18+
19+ bool isWithinNewGrid =
20+ i < newGridHeight && sourceCol >= 0 && sourceCol < newGridWidth;
21+
1422 bool animationCondition =
15- (isNewGridCell && processGrid[i][startCol + j ]);
23+ (isWithinNewGrid && processGrid[i][sourceCol ]);
1624
1725 canvas[i][j] = animationCondition;
1826 }
You can’t perform that action at this time.
0 commit comments