Dashboard: resize modules by mouse, overlays, link groups and colours in levels; read-only switch on phones
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ea9fa32bc
commit
b82a6b90c6
8 files changed
+183
-60
No files matched your search
+26
-5
@@ -803,8 +803,8 @@ async function presetFileDialog(d) {
|
||||
"active state – stored presets (U01 …) stay unchanged.", { name: q(d.state.preset_name || "—") })),
|
||||
last ? h("p", { class: "dlg-text" }, t("A backup is made automatically before every import. Last backup: {last}.", { last })) : null),
|
||||
actions: [{ label: t("Close") },
|
||||
...(last && !S.locked ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(S.locked ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
...(last && !viewOnly() ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(viewOnly() ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
{ label: t("Export"), primary: true, value: () => "export" }],
|
||||
});
|
||||
try {
|
||||
@@ -2481,10 +2481,28 @@ new ResizeObserver(() => document.documentElement.style.setProperty("--sb", $("#
|
||||
|
||||
// ------------------------------------------------------------------ lock (desktop app window: look, don't touch)
|
||||
|
||||
// Phones and tablets on the web UI start read-only, so nothing changes by touching it by accident.
|
||||
// Only a safety catch in this browser tab: it is not stored and the server knows nothing about it.
|
||||
const viewOnly = () => !!S.locked || !!S.guard;
|
||||
function showGuard() {
|
||||
const b = $("#btn-guard"), used = !S.isApp && S.guardUsed;
|
||||
b.hidden = !used;
|
||||
b.setAttribute("aria-checked", String(!S.guard));
|
||||
b.classList.toggle("on", !S.guard);
|
||||
b.title = S.guard ? t("Read-only – tap to edit") : t("Editing – tap for read-only");
|
||||
b.setAttribute("aria-label", b.title);
|
||||
b.replaceChildren(h("span", { class: "guardlab" }, S.guard ? t("View") : t("Edit")), h("span", { class: "guardtrack" }, h("i")));
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
}
|
||||
$("#btn-guard").addEventListener("click", () => {
|
||||
S.guard = !S.guard; showGuard(); render();
|
||||
toast(S.guard ? t("Read-only") : t("Edit mode – changes go to the DSP"));
|
||||
});
|
||||
|
||||
function showLock() {
|
||||
const b = $("#btn-lock");
|
||||
b.hidden = !S.isApp;
|
||||
document.body.classList.toggle("locked", !!S.locked);
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
b.classList.toggle("on", !!S.locked);
|
||||
b.title = S.locked ? t("Locked – click to unlock") : t("Lock (view only)");
|
||||
b.setAttribute("aria-label", b.title);
|
||||
@@ -2516,14 +2534,14 @@ $("#btn-lock").addEventListener("click", async () => {
|
||||
const VIEW_OK = ".chsel, .nav, .strip-head, .xout, .band, #btn-muteall, [data-view-ok]";
|
||||
for (const type of ["pointerdown", "mousedown", "click", "dblclick", "keydown", "wheel"]) {
|
||||
document.addEventListener(type, e => {
|
||||
if (!S.locked || !(e.target instanceof Element)) return;
|
||||
if (!viewOnly() || !(e.target instanceof Element)) return;
|
||||
const tgt = e.target;
|
||||
if (!tgt.closest("#main, #statusbar") || tgt.closest(VIEW_OK)) return;
|
||||
if (type === "wheel" && !tgt.closest(".fader, input, select")) return; // page scrolling stays
|
||||
if (type === "keydown" && !tgt.closest("button, input, select, textarea, .fader, [tabindex]")) return;
|
||||
if (type === "pointerdown" && !tgt.closest("button, input, select, textarea, .fader, canvas, a")) return;
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(t("Locked – unlock at the top right to make changes")); }
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(S.locked ? t("Locked – unlock at the top right to make changes") : t("Read-only – switch to edit at the top")); }
|
||||
}, { capture: true, passive: false });
|
||||
}
|
||||
|
||||
@@ -2694,6 +2712,9 @@ async function startApp() {
|
||||
if (store.get("dsp.lang") === a.lang) return location.reload();
|
||||
}
|
||||
S.locked = !!a.locked;
|
||||
S.guardUsed = !S.isApp && matchMedia("(max-width: 759px), (pointer: coarse)").matches;
|
||||
S.guard = S.guardUsed;
|
||||
showGuard();
|
||||
showLock();
|
||||
showMuteAll();
|
||||
if (S.isApp) S.remote = await api("GET", "/api/remote");
|
||||
|
||||
Reference in new issue
Block a user