Fix PEQ sliders losing the mouse drag, show inverted polarity in the mixer
- PEQ sliders no longer rebuild themselves on every change (the browser lost the drag); only the band buttons and the curve are updated while dragging - mixer strips show a "Ø" badge next to the link symbol when the polarity is inverted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
96640c5bff
commit
58492e985f
3 files changed
+18
-6
No files matched your search
+15
-6
@@ -157,6 +157,9 @@ const linkBadge = (d, kind, i) => {
|
||||
return l ? h("span", { class: "lnk", style: `--lc:${l.color}`, title: t("Linked: ") + l.group.map(j => chLabel(kind, j)).join(" + ") },
|
||||
svgIcon(ICON.link)) : null;
|
||||
};
|
||||
// polarity inverted ("Phase Ø" in the channel view)
|
||||
const polBadge = (d, kind, i) => chans(d, kind)[i].polarity
|
||||
? h("span", { class: "pol", title: t("Phase inverted") }, "Ø") : null;
|
||||
|
||||
function getPath(obj, path) {
|
||||
return path.split(".").reduce((o, k) => o[Array.isArray(o) ? +k : k], obj);
|
||||
@@ -757,7 +760,7 @@ function strip(d, kind, i) {
|
||||
});
|
||||
el.append(
|
||||
h("button", { class: "strip-head", onclick: () => openChannel(kind, i), title: t("Edit channel") },
|
||||
h("span", { class: "kind" }, chLabel(kind, i), linkBadge(d, kind, i)), h("span", { class: "nm" }, ch.name || " "),
|
||||
h("span", { class: "kind" }, chLabel(kind, i), linkBadge(d, kind, i), polBadge(d, kind, i)), h("span", { class: "nm" }, ch.name || " "),
|
||||
kind === "out" ? limLed(d.id, i) : h("span", { class: "limled ph", "aria-hidden": "true" })), // keeps faders level with the outputs
|
||||
h("div", { class: "faderbox" }, ledMeter(d.id, kind, i), f),
|
||||
db,
|
||||
@@ -968,24 +971,30 @@ function peqCard(d, kind, idx) {
|
||||
const redraw = () => drawCurve(canvas, chans(dev(), kind)[idx], S.band);
|
||||
const body = h("div", { class: "bandparams" });
|
||||
const bandBtns = h("div", { class: "bands", role: "tablist" });
|
||||
const renderBand = () => {
|
||||
const c = chans(dev(), kind)[idx], b = c.peq[S.band], p = `peq.${S.band}`;
|
||||
const renderBtns = () => {
|
||||
const c = chans(dev(), kind)[idx];
|
||||
bandBtns.replaceChildren(...c.peq.map((bb, i) => h("button", {
|
||||
class: "band" + (i === S.band ? " on" : "") + (bb.bypass ? " bypassed" : "") + (hasGain(bb.type) && bb.gain !== 120 ? " active" : ""),
|
||||
role: "tab", "aria-selected": String(i === S.band),
|
||||
onclick: () => { S.band = i; renderBand(); redraw(); } },
|
||||
h("b", {}, String(i + 1)), h("small", {}, fmtHzShort(freqHz(bb.freq))),
|
||||
h("small", {}, hasGain(bb.type) ? sign(eqDb(bb.gain)) : PEQ_SHORT[bb.type]))));
|
||||
};
|
||||
const renderBand = () => {
|
||||
const c = chans(dev(), kind)[idx], b = c.peq[S.band], p = `peq.${S.band}`;
|
||||
renderBtns();
|
||||
const both = () => { renderBand(); redraw(); };
|
||||
// sliders must not rebuild themselves while being dragged (the mouse would lose them): buttons + curve only
|
||||
const light = () => { renderBtns(); redraw(); };
|
||||
body.replaceChildren(
|
||||
h("div", { class: "row bandhead" },
|
||||
h("label", { class: "inline" }, t("Type"), paramSelect(kind, idx, p + ".type", PEQ_TYPES, both, t("Filter type"))),
|
||||
toggleBtn("Bypass", kind, idx, p + ".bypass", "", both),
|
||||
hasGain(b.type) ? h("button", { onclick: () => { setParam(kind, idx, p + ".gain", 120); both(); } }, "0 dB") : null),
|
||||
h("div", { class: "pgrid" },
|
||||
paramSlider(t("Frequency"), kind, idx, p + ".freq", "freq", both),
|
||||
hasGain(b.type) ? paramSlider("Gain", kind, idx, p + ".gain", "eqgain", both) : null,
|
||||
hasQ(b.type) ? paramSlider("Q", kind, idx, p + ".q", "q", both) : null));
|
||||
paramSlider(t("Frequency"), kind, idx, p + ".freq", "freq", light),
|
||||
hasGain(b.type) ? paramSlider("Gain", kind, idx, p + ".gain", "eqgain", light) : null,
|
||||
hasQ(b.type) ? paramSlider("Q", kind, idx, p + ".q", "q", light) : null));
|
||||
};
|
||||
// drag points on the curve (gain snaps to 0 dB)
|
||||
let drag = null;
|
||||
|
||||
Reference in new issue
Block a user