fix: use a compact 40 to 200 pixel tile range

This commit is contained in:
ajnart committed 2026-09-09 15:33:14 +02:00
1 parent 9256a432f9
commit dbc24e9091
7 files changed
+13 -14

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@ layouts can use any other breakpoint, and Homarr selects the highest breakpoint
roles and use the canonical layouts returned by save operations, including generated IDs.
Board settings expose `fixedScaling` and `fixedItemSize`. The default fitted mode uses `fixedScaling: false`; setting it
to `true` keeps each `1 × 1` tile at `fixedItemSize` pixels, which must be an integer from `100` through `400`. The
to `true` keeps each `1 × 1` tile at `fixedItemSize` pixels, which must be an integer from `40` through `200`. The
configured size is retained while fixed scaling is disabled. Layout `columnCount` remains the maximum total column count,
including fixed sidebars.
+1 -1
View File
@@ -75,7 +75,7 @@ draft; **Discard** restores the saved settings.
### Try a layout before saving
Choose **Fixed scaling** or **Fit to screen** under **Tile sizing**. Fixed sizing accepts **100–400 px**; its square
Choose **Fixed scaling** or **Fit to screen** under **Tile sizing**. Fixed sizing accepts **40–200 px**; its square
sample is shown at half size with the configured dimensions underneath. The size is retained when you switch modes.
Select a layout to edit its columns, breakpoint, and side rails beside the compact **Board preview**. It uses the
+2 -2
View File
@@ -2156,8 +2156,8 @@
},
"fixedItemSize": {
"type": "integer",
"minimum": 100,
"maximum": 400
"minimum": 40,
"maximum": 200
},
"disableStatus": {
"type": "boolean"
@@ -10,7 +10,7 @@ import { clientApi } from "@homarr/api/client";
import { useUpdateBoard } from "@homarr/boards/updater";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { env } from "@homarr/common/env";
import { BOARD_FIXED_ITEM_SIZE_DEFAULT } from "@homarr/definitions";
import { normalizeFixedItemSize } from "~/components/board/layout/scaling";
import { useZodForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
import { useSettings } from "@homarr/settings";
@@ -83,7 +83,7 @@ const buildInitialValues = (board: Board): FormValues => ({
customCss: board.customCss ?? "",
disableStatus: board.disableStatus,
fixedScaling: board.fixedScaling ?? false,
fixedItemSize: board.fixedItemSize ?? BOARD_FIXED_ITEM_SIZE_DEFAULT,
fixedItemSize: normalizeFixedItemSize(board.fixedItemSize ?? ""),
layouts: normalizeMobileLayoutGutters(board.layouts),
});
@@ -41,7 +41,6 @@ import type { z } from "zod/v4";
import type { RouterOutputs } from "@homarr/api";
import { clientApi } from "@homarr/api/client";
import {
BOARD_FIXED_ITEM_SIZE_DEFAULT,
BOARD_FIXED_ITEM_SIZE_MAX,
BOARD_FIXED_ITEM_SIZE_MIN,
backgroundImageAttachments,
@@ -96,7 +95,7 @@ const normalizeFormValues = (
itemRadius: values.itemRadius,
disableStatus: values.disableStatus,
fixedScaling: values.fixedScaling ?? false,
fixedItemSize: values.fixedItemSize ?? BOARD_FIXED_ITEM_SIZE_DEFAULT,
fixedItemSize: normalizeFixedItemSize(values.fixedItemSize ?? ""),
};
};
@@ -14,7 +14,7 @@ import {
} from "../scaling";
describe("board canvas scale policy", () => {
test.each([100, 150, 200, 400])("renders an exact %s CSS-pixel fixed tile", (itemSize) => {
test.each([40, 80, 100, 200])("renders an exact %s CSS-pixel fixed tile", (itemSize) => {
const scale = calculateFixedBoardCanvasScale(itemSize);
expect(LOGICAL_GRID_PITCH * scale - 2 * BOARD_GRID_ITEM_INSET).toBeCloseTo(itemSize);
});
@@ -27,9 +27,9 @@ describe("board canvas scale policy", () => {
);
test("clamps and rounds the configured fixed size", () => {
expect(normalizeFixedItemSize(20)).toBe(100);
expect(normalizeFixedItemSize(700)).toBe(400);
expect(normalizeFixedItemSize(200.7)).toBe(201);
expect(normalizeFixedItemSize(20)).toBe(40);
expect(normalizeFixedItemSize(400)).toBe(200);
expect(normalizeFixedItemSize(100.7)).toBe(101);
});
test.each([0.75, 1, 1.25, 1.5, 2])("preserves fixed CSS dimensions at browser zoom %s", (zoom) => {
+2 -2
View File
@@ -11,8 +11,8 @@ export const backgroundImageSizes = createDefinition(["cover", "contain"], {
export const layoutRoles = createDefinition(["mobile", "base", "custom"], { defaultValue: "custom" });
export const BOARD_FIXED_ITEM_SIZE_DEFAULT = 200;
export const BOARD_FIXED_ITEM_SIZE_MIN = 100;
export const BOARD_FIXED_ITEM_SIZE_MAX = 400;
export const BOARD_FIXED_ITEM_SIZE_MIN = 40;
export const BOARD_FIXED_ITEM_SIZE_MAX = 200;
export type BackgroundImageAttachment = inferDefinitionType<typeof backgroundImageAttachments>;
export type BackgroundImageRepeat = inferDefinitionType<typeof backgroundImageRepeats>;