draw black background for thumbnail boxes

This commit is contained in:
Colin McMillen 2023-07-25 17:18:11 -04:00
parent 4f1adef895
commit f9aeb81313

View File

@ -355,6 +355,7 @@ public class UiGeometry {
private static CameraInfo activeCamera = CameraInfo.CANON_EOS_R6M2;
public readonly Vector2i WindowSize;
public readonly Box2i ThumbnailBox;
public readonly List<Box2i> ThumbnailBoxes = new();
public readonly Box2i PhotoBox;
public readonly Box2i StatusBox;
@ -376,6 +377,7 @@ public class UiGeometry {
int statusBoxPadding = 4;
PhotoBox = new Box2i(0, 0, WindowSize.X - thumbnailWidth, WindowSize.Y - statusBoxHeight - statusBoxPadding);
StatusBox = new Box2i(0, WindowSize.Y - statusBoxHeight, WindowSize.X - thumbnailWidth, WindowSize.Y);
ThumbnailBox = new Box2i(ThumbnailBoxes[0].Min.X, ThumbnailBoxes[0].Min.Y, WindowSize.X, WindowSize.Y);
}
}
@ -620,18 +622,12 @@ public class Game : GameWindow {
}
Vector2i renderSize = (Vector2i) (((Vector2) active.Size) * scale);
// FIXME: clip by the actual PhotoBox size -- this bleeds over UI elements when zoomed in.
// This doesn't work -- boo.
// if (renderSize.X > geometry.PhotoBox.Size.X) {
// renderSize.X = geometry.PhotoBox.Size.X;
// }
// if (renderSize.Y > geometry.PhotoBox.Size.Y) {
// renderSize.Y = geometry.PhotoBox.Size.Y;
// }
Vector2i center = (Vector2i) geometry.PhotoBox.Center;
Box2i photoBox = Util.MakeBox(center.X - renderSize.X / 2, center.Y - renderSize.Y / 2, renderSize.X, renderSize.Y);
DrawTexture(active, photoBox);
// Draw thumbnail boxes.
DrawFilledBox(geometry.ThumbnailBox, Color4.Black);
for (int i = 0; i < photos.Count && i < geometry.ThumbnailBoxes.Count(); i++) {
Box2i box = geometry.ThumbnailBoxes[i];
DrawTexture(photos[i].Texture(), box);