Skip to content

TileLayout

Class in Oadm.Sdk.Layout · Oadm.Sdk.dll

The rules of a tile grid (TileLayout.Size x TileLayout.Size cells that always fill the page): tiles stay inside, are at least TileLayout.MinTileSize cells wide and high, never overlap, and there are at most TileLayout.MaxTiles. A dropped tile takes the largest free square at the drop point (up to TileLayout.DropSize), else the largest free square nearest to it. Used by the page while editing and by the server part before it stores (no UI here).

public sealed class TileLayout
TileLayout(int size = 20, int minTileSize = 2, int dropSize = 10, int maxTiles = 16)

A layout with the given rules (Live View: 20 cells, 2 x 2 at least, drops up to 10 x 10, 16 tiles).

int DropSize { get; }

The largest square a dropped tile takes.

int MaxTiles { get; }

Tiles in one grid at most.

int MinTileSize { get; }

The smallest tile, in cells per side.

int Size { get; }

Columns and rows of the grid.

TileRect Drag(TileRect start, TileEdges edges, int dx, int dy)

The rectangle after dragging edges of start by whole cells (no edge = move): the opposite edges stay, the tile keeps the smallest size and stays inside the grid. Overlaps are checked by TileLayout.Fit.

static int FirstOverlap(IReadOnlyList<TileRect> tiles)

The index of the first tile that overlaps an earlier one, or -1.

TileRect? Fit(IReadOnlyList<TileRect> others, int x, int y, int width, int height)

A tile moved to (x, y) and sized to width x height, kept inside the grid and at least the smallest size; null when it would overlap one of others.

bool Fits(TileRect tile)

Inside the grid and at least the smallest size.

TileRect? Place(IReadOnlyList<TileRect> tiles, int cellX, int cellY)

The place of a tile dropped at (cellX, cellY), or null when nothing is free.

TileRect? PlaceFirstFree(IReadOnlyList<TileRect> tiles)

The first free place, top left first (a click on an item while editing).

TileRect? PlaceSized(IReadOnlyList<TileRect> tiles, int width, int height)

The first free place for a tile of width x height (row by row, top left first), e.g. a copy of a tile; null when the grid is full or no such place is free.