feat: Allow control of where selected item is in grid (#1979)
- Closes: #1946
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
# Grid Layout Algorithm
|
||||
|
||||
When display mode (in `live` or `media_viewer` views) is set to `grid`, it will lay out cameras roughly in the order they are specified in the config (items may be moved to optimize grid 'density').
|
||||
When display mode (in [`live`](live.md?id=display) or
|
||||
[`media_viewer`](media-viewer.md?id=display) views) is set to `grid`, this
|
||||
algorithm is used to control the layout.
|
||||
|
||||
The following algorithm is used to calculate the number of columns. This attempts to offers a balance between configurability, reasonable display in a typical Lovelace card width and reasonable display in a typical fullscreen display.
|
||||
## Layout Order
|
||||
|
||||
Cameras are laid out horizontally in the order they are specified in the config,
|
||||
first to last. The card may tweak item positioning in order to optimize grid
|
||||
'density'.
|
||||
|
||||
In addition, if the `grid_selected_position` parameter is `first` or `last`, the
|
||||
selected camera is always laid out first (at the top) or last (at the bottom) of
|
||||
the layout.
|
||||
|
||||
## Number of columns in the grid
|
||||
|
||||
The following algorithm is used to calculate the number of columns. This
|
||||
attempts to offers a balance between configurability, reasonable display in a
|
||||
typical Lovelace card width and reasonable display in a typical fullscreen
|
||||
display.
|
||||
|
||||
- Use `grid_columns` if specified.
|
||||
- Otherwise, use the largest number of columns in the range `[2 - grid_max_columns]` that will fit at least a `600px` column width.
|
||||
- Otherwise, use the largest number of columns in the range `[2 - grid_max_columns]` that will fit at least a `190px` column width.
|
||||
- Otherwise, use the largest number of columns in the range `[2 -
|
||||
grid_max_columns]` that will fit at least a `600px` column width.
|
||||
- Otherwise, use the largest number of columns in the range `[2 -
|
||||
grid_max_columns]` that will fit at least a `190px` column width.
|
||||
- Otherwise, there will be `1` column only.
|
||||
|
||||
Reference in New Issue
Block a user