GridView fixed size position to top left

- Port changes for tview to not position fixed
  size items into bottom right if item in
  question is last one.
- Fixes #1010
This commit is contained in:
Janne Valkealahti
2024-04-15 08:59:15 +01:00
parent 544601c679
commit 054db7651f
2 changed files with 20 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -525,20 +525,6 @@ public class GridView extends BoxView {
offsetX += width2 + add;
}
// Line up the last row/column with the end of the available area.
int border = 0;
if (isShowBorders()) {
border = 1;
}
int last = rowPos.length - 1;
if (rowPos[last] + rowHeight[last] + border - offsetY < height) {
offsetY = rowPos[last] - height + rowHeight[last] + border;
}
last = columnPos.length - 1;
if (columnPos[last] + columnWidth[last] + border - offsetX < width) {
offsetX = columnPos[last] - width + columnWidth[last] + border;
}
// The focused item must be within the visible area.
if (focus != null) {
if (focus.y + focus.h - offsetY >= height) {