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:
1 parent
06bc767f2c
commit
dc355fa160
2 files changed
+20
-4
No files matched your search
+10
-2
@@ -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);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user