Max level: grey zone between the limit and a knob set above it, red above the knob

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-01 23:42:12 +01:00
1 parent 06bc767f2c
commit dc355fa160
2 files changed
+20 -4

No files matched your search

+10 -2
View File
@@ -393,6 +393,7 @@ function paramSlider(label, kind, idx, path, specName, onChange) {
v = clamp(Math.round(v), spec.min, spec.max);
if (path === "gain" && !force) { const c = gainCap(dev(), kind, idx); if (c != null) v = Math.min(v, c); } // software max level
input.value = v;
input.limSync && input.limSync();
if (v === cur()) return;
if (v === spec.zero) buzz();
val.textContent = spec.fmt(v);
@@ -400,7 +401,7 @@ function paramSlider(label, kind, idx, path, specName, onChange) {
setParam(kind, idx, path, v, force);
onChange && onChange(v);
};
onLive(kind, idx, path, v => { input.value = v; val.textContent = spec.fmt(v); wrap.classList.toggle("atzero", v === spec.zero); });
onLive(kind, idx, path, v => { input.value = v; input.limSync && input.limSync(); val.textContent = spec.fmt(v); wrap.classList.toggle("atzero", v === spec.zero); });
input.addEventListener("input", () => {
let v = +input.value;
if (dragging) v = detent(v, spec.zero, spec.max - spec.min, input.clientWidth - 26);
@@ -425,6 +426,11 @@ function paramSlider(label, kind, idx, path, specName, onChange) {
if (lim != null) { // locked range above the max level, part of the track (stays behind the knob)
input.classList.add("haslim");
input.style.setProperty("--lim", (lim - spec.min) / (spec.max - spec.min));
const showVal = () => input.style.setProperty("--val", (Math.max(+input.value, lim) - spec.min) / (spec.max - spec.min));
showVal();
input.addEventListener("input", showVal);
new MutationObserver(showVal).observe(input, { attributes: true, attributeFilter: ["value"] });
input.limSync = showVal;
input.title = `${t("Max level")}: ${spec.fmt(lim)}`;
}
const track = h("div", { class: "rangewrap" },
@@ -463,10 +469,12 @@ function fader({ min, max, value, zero, ticks, label, onInput, cap, limit }) {
const tickEls = (ticks || []).map(([v, label]) => h("div", { class: "tick" + (v === zero ? " z" : ""), style: `--f:${(v - min) / (max - min)}` }, label ? h("span", {}, label) : null));
const el = h("div", { class: "fader", tabindex: "0", role: "slider", "aria-label": label || "Fader",
"aria-valuemin": min, "aria-valuemax": max }, h("div", { class: "track" }), tickEls,
limit != null ? h("div", { class: "limzone", style: `--f:${(limit - min) / (max - min)}`, title: t("Max level") }) : null, capEl);
limit != null ? h("div", { class: "limzone", style: `--f:${(limit - min) / (max - min)}`, title: t("Max level") }) : null,
limit != null ? h("div", { class: "limbelow", style: `--f:${(limit - min) / (max - min)}` }) : null, capEl);
let cur = value;
const place = () => {
capEl.style.setProperty("--f", (cur - min) / (max - min));
el.style.setProperty("--v", (cur - min) / (max - min)); // used by the max level zone
el.setAttribute("aria-valuenow", cur);
el.classList.toggle("atzero", cur === zero);
};
+10 -2
View File
@@ -687,13 +687,18 @@ button.devadd .plus svg { width: 32px; height: 32px; fill: none; stroke: current
.scanrow small { display: block; color: var(--dim); font-size: 12px; }
/* ---- software max level: a striped "locked" zone in the track above the limit, behind the knob */
:root { --limstripe: repeating-linear-gradient(-45deg, #ef444466 0 3px, #ef444414 3px 6px); }
input[type=range].haslim { --p: calc(13px + var(--lim) * (100% - 26px)); }
:root { --limgrey: repeating-linear-gradient(-45deg, #8a95a366 0 3px, #8a95a314 3px 6px); --limstripe: repeating-linear-gradient(-45deg, #ef444466 0 3px, #ef444414 3px 6px); }
/* --p = limit, --q = knob: between them (knob above the limit, set on the DSP) the stripes turn grey, above the knob red */
input[type=range].haslim { --p: calc(13px + var(--lim) * (100% - 26px)); --q: calc(13px + var(--val, var(--lim)) * (100% - 26px)); }
input[type=range].haslim::-webkit-slider-runnable-track {
background: linear-gradient(90deg, var(--line) 0 var(--p), #f87171 var(--p) calc(var(--p) + 2px), transparent calc(var(--p) + 2px)),
var(--limgrey) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
linear-gradient(var(--line), var(--line)) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
var(--limstripe) var(--line); }
input[type=range].haslim::-moz-range-track {
background: linear-gradient(90deg, var(--line) 0 var(--p), #f87171 var(--p) calc(var(--p) + 2px), transparent calc(var(--p) + 2px)),
var(--limgrey) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
linear-gradient(var(--line), var(--line)) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
var(--limstripe) var(--line); }
.fader .limzone { position: absolute; left: var(--tx); width: 10px; margin-left: -5px; top: 12px; border-radius: 5px 5px 2px 2px;
height: calc((1 - var(--f)) * (100% - 24px)); background: var(--limstripe); pointer-events: none; z-index: 0; }
@@ -709,3 +714,6 @@ input[type=range].haslim::-moz-range-track {
.mlval { font-size: 12px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.mlval.on { color: var(--bad); font-weight: 600; }
.mlwarn { grid-column: 2 / -1; color: var(--warn); font-size: 11px; margin-top: -4px; }
.fader .limbelow { position: absolute; left: var(--tx); width: 10px; margin-left: -5px; pointer-events: none; z-index: 0;
bottom: calc(12px + var(--f) * (100% - 24px)); height: calc(max(0, var(--v, 0) - var(--f)) * (100% - 24px));
background: var(--limgrey), #0b0d10; border-radius: 2px; }