multiple columns of thumbnails
This commit is contained in:
parent
31f2668aa3
commit
aa5b3e7083
21
Program.cs
21
Program.cs
@ -237,7 +237,6 @@ public class UiGeometry {
|
|||||||
public static Vector2i MIN_WINDOW_SIZE = new(1024, 768);
|
public static Vector2i MIN_WINDOW_SIZE = new(1024, 768);
|
||||||
|
|
||||||
public readonly Vector2i WindowSize;
|
public readonly Vector2i WindowSize;
|
||||||
public readonly Vector2i ThumbnailSize;
|
|
||||||
public readonly Box2i ThumbnailBox;
|
public readonly Box2i ThumbnailBox;
|
||||||
public readonly List<Box2i> ThumbnailBoxes = new();
|
public readonly List<Box2i> ThumbnailBoxes = new();
|
||||||
public readonly List<Box2i> StarBoxes = new();
|
public readonly List<Box2i> StarBoxes = new();
|
||||||
@ -249,24 +248,26 @@ public class UiGeometry {
|
|||||||
public UiGeometry(Vector2i windowSize, int starSize) {
|
public UiGeometry(Vector2i windowSize, int starSize) {
|
||||||
WindowSize = windowSize;
|
WindowSize = windowSize;
|
||||||
|
|
||||||
int numThumbnails = Math.Max(WindowSize.Y / 100, 1);
|
int numThumbnailsPerColumn = Math.Max(WindowSize.Y / 100, 1);
|
||||||
int thumbnailHeight = WindowSize.Y / numThumbnails;
|
int thumbnailHeight = WindowSize.Y / numThumbnailsPerColumn;
|
||||||
int thumbnailWidth = (int) (1.0 * thumbnailHeight * CameraInfo.AspectRatio);
|
int thumbnailWidth = (int) (1.0 * thumbnailHeight * CameraInfo.AspectRatio);
|
||||||
ThumbnailSize = new(thumbnailWidth, thumbnailHeight);
|
|
||||||
|
|
||||||
Console.WriteLine($"thumbnail size: {thumbnailWidth}x{thumbnailHeight}");
|
Console.WriteLine($"thumbnail size: {thumbnailWidth}x{thumbnailHeight}");
|
||||||
for (int i = 0; i < numThumbnails; i++) {
|
int thumbnailColumns = 3;
|
||||||
Box2i box = Util.MakeBox(WindowSize.X - thumbnailWidth, i * thumbnailHeight,
|
for (int j = thumbnailColumns; j > 0; j--) {
|
||||||
thumbnailWidth, thumbnailHeight);
|
for (int i = 0; i < numThumbnailsPerColumn; i++) {
|
||||||
ThumbnailBoxes.Add(box);
|
Box2i box = Util.MakeBox(WindowSize.X - thumbnailWidth * j, i * thumbnailHeight,
|
||||||
|
thumbnailWidth, thumbnailHeight);
|
||||||
|
ThumbnailBoxes.Add(box);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int statusBoxHeight = 40;
|
int statusBoxHeight = 40;
|
||||||
int statusBoxPadding = 4;
|
int statusBoxPadding = 4;
|
||||||
PhotoBox = new Box2i(
|
PhotoBox = new Box2i(
|
||||||
0, 0, WindowSize.X - thumbnailWidth, WindowSize.Y - statusBoxHeight - statusBoxPadding);
|
0, 0, WindowSize.X - thumbnailWidth * thumbnailColumns, WindowSize.Y - statusBoxHeight - statusBoxPadding);
|
||||||
StatusBox = new Box2i(
|
StatusBox = new Box2i(
|
||||||
0, WindowSize.Y - statusBoxHeight, WindowSize.X - thumbnailWidth, WindowSize.Y);
|
0, WindowSize.Y - statusBoxHeight, WindowSize.X - thumbnailWidth * thumbnailColumns, WindowSize.Y);
|
||||||
ThumbnailBox = new Box2i(
|
ThumbnailBox = new Box2i(
|
||||||
ThumbnailBoxes[0].Min.X, ThumbnailBoxes[0].Min.Y, WindowSize.X, WindowSize.Y);
|
ThumbnailBoxes[0].Min.X, ThumbnailBoxes[0].Min.Y, WindowSize.X, WindowSize.Y);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user