-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathWallSizer.cs
43 lines (34 loc) · 1.26 KB
/
WallSizer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Xamarin.Forms;
namespace XamJam.Wall
{
/// <summary>
/// Interface for any algorithm that would like to determine how to fill up a wall (defined by screenWidth and screenHeight) with items.
/// </summary>
public interface WallSizer
{
WallSize Size(double screenWidth, double screenHeight);
}
/// <summary>
/// Dictates how items should be uniformly laid out to fill up a Wall. This includes the size of each item, how many rows and columns, and x and y padding
/// </summary>
public class WallSize
{
public WallSize(double paddingX, double paddingY, Size itemSize, int numRows, int numColumns)
{
PaddingX = paddingX;
PaddingY = paddingY;
ItemSize = itemSize;
NumRows = numRows;
NumColumns = numColumns;
ItemSizeWithPadding = new Size(ItemSize.Width + paddingX, ItemSize.Height + paddingY);
MaxNumItems = NumRows * NumColumns;
}
public double PaddingX { get; }
public double PaddingY { get; }
public Size ItemSizeWithPadding { get; }
public Size ItemSize { get; }
public int NumRows { get; }
public int NumColumns { get; }
public int MaxNumItems { get; }
}
}