This commit is contained in:
Mateusz Gruszczyński committed 2026-11-09 11:42:46 +01:00
1 parent 992a1795af
commit b9d716d260
3 files changed
+105 -9

No files matched your search

+7 -2
View File
@@ -79,7 +79,8 @@ window.rustProxyInlineLayout = (() => {
const explicit = draft.heights?.[node.dataset.dashboardWidget] !== undefined;
const heightValue = node.querySelector(".overview-inline-height-value");
if (heightValue) {
heightValue.textContent = `↕${rows.span}${explicit ? "" : " A"}`;
heightValue.textContent = `↕${rows.span}`;
heightValue.classList.toggle("is-auto", !explicit);
heightValue.title = explicit ? t("overviewLayoutHeightFixed") : t("overviewLayoutHeightAuto");
}
const lower = node.querySelector(".overview-inline-lower");
@@ -161,7 +162,9 @@ window.rustProxyInlineLayout = (() => {
control("−", `${t("overviewLayoutLower")}: ${title}`, "overview-inline-lower", () => resizeHeight(id, -1)),
heightValue,
control("+", `${t("overviewLayoutTaller")}: ${title}`, "overview-inline-taller", () => resizeHeight(id, 1)));
bar.append(grip, dashboardWidgetTypeBadge(id), sizeControls, heightControls,
const name = el("span", title, "overview-inline-name");
name.title = title;
bar.append(grip, name, dashboardWidgetTypeBadge(id), sizeControls, heightControls,
control("←", `${t("moveUp")}: ${title}`, "overview-inline-up", () => nudge(id, -1)),
control("→", `${t("moveDown")}: ${title}`, "overview-inline-down", () => nudge(id, 1)),
control("×", `${t("overviewLayoutInlineHide")}: ${title}`, "overview-inline-hide", () => hide(id)));
@@ -197,6 +200,8 @@ window.rustProxyInlineLayout = (() => {
if (modalButton) modalButton.disabled = false;
if (!preserveSaved && original) applyDashboardLayout(original.order, [...original.hidden], original.sizes, original.heights);
draft = original = null;
// Recompute from scratch so the saved view is exactly what was arranged.
window.rustProxyOverviewRows?.flush?.();
}
async function begin() {
if (draft || opening || saving || $("overview-presets-dialog")?.open) return;
+6 -1
View File
@@ -35,12 +35,17 @@ window.rustProxyOverviewRows = (() => {
lastWidth = grid.clientWidth;
const items = cards().filter(node => !node.hidden && node.getClientRects().length);
if (!items.length) return;
grid.classList.add("is-measuring-rows");
// Measure as the saved (locked) dashboard: editing styles move a few
// controls inside cards, which must not change the layout being edited.
const editing = grid.classList.contains("is-unlocked");
if (editing) grid.classList.remove("is-unlocked");
grid.classList.add("has-row-units", "is-measuring-rows");
// Bounding boxes include CSS zoom (Settings → Interface scale); grid tracks,
// gaps and the row unit are in CSS pixels, so divide measurements by it.
const zoom = zoomOf();
const natural = items.map(node => node.getBoundingClientRect().height / zoom);
grid.classList.remove("is-measuring-rows");
if (editing) grid.classList.add("is-unlocked");
const gap = parseFloat(getComputedStyle(grid).rowGap) || 0;
const isStat = node => node.classList.contains("stat");
// The unit is half of the smallest stat card, so every card ends within a