feat: mobile version of gain section
This commit is contained in:
@@ -10,4 +10,4 @@ This template should help get you started developing with Tauri, React and Types
|
|||||||
|
|
||||||
- Check end to end behavioour
|
- Check end to end behavioour
|
||||||
|
|
||||||
- Make phone version
|
- Make phone version (avoid slider move when scrolling horizontaly)
|
||||||
@@ -1,3 +1,24 @@
|
|||||||
|
/* ---------- Page wrapper ---------- */
|
||||||
|
|
||||||
|
.gain-page {
|
||||||
|
display: contents; /* invisible on desktop; a flex column on phones */
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-tabs,
|
||||||
|
.gain-rotate-hint {
|
||||||
|
display: none; /* phones only */
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__btns {
|
||||||
|
display: contents; /* desktop: buttons stay direct children of the panel */
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__btn-short {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Fader strip ---------- */
|
||||||
|
|
||||||
.gain-section {
|
.gain-section {
|
||||||
container-type: size;
|
container-type: size;
|
||||||
|
|
||||||
@@ -5,6 +26,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
z-index: 20;
|
||||||
|
|
||||||
height: var(--dsp-control-heigth);
|
height: var(--dsp-control-heigth);
|
||||||
|
|
||||||
@@ -13,12 +35,9 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
background: var(--bg-panel);
|
background: var(--bg-panel);
|
||||||
|
|
||||||
z-index: 20;
|
|
||||||
|
|
||||||
border-top: var(--border-width) solid var(--border-hairline);
|
border-top: var(--border-width) solid var(--border-hairline);
|
||||||
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
}
|
}
|
||||||
@@ -33,39 +52,50 @@
|
|||||||
|
|
||||||
.gain-panel {
|
.gain-panel {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
flex: 0 0 auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
aspect-ratio: 1 / 4;
|
aspect-ratio: 1 / 4;
|
||||||
flex: 0 0 auto;
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
gap: 2cqh;
|
||||||
|
|
||||||
|
padding-bottom: 2cqh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
background: var(--bg-void);
|
||||||
border: var(--border-width) solid var(--border-hairline);
|
border: var(--border-width) solid var(--border-hairline);
|
||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
box-sizing: border-box;
|
|
||||||
gap: 2cqh;
|
|
||||||
background: var(--bg-void);
|
|
||||||
padding-bottom: 2cqh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gain-panel__title {
|
.gain-panel__title {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
min-width: 0;
|
||||||
|
|
||||||
|
padding-block: 2cqh;
|
||||||
|
|
||||||
font-family: var(--font-ui);
|
font-family: var(--font-ui);
|
||||||
font-size: 4cqh;
|
font-size: 4cqh;
|
||||||
font-weight: var(--font-weight-semibold);
|
font-weight: var(--font-weight-semibold);
|
||||||
padding-top: 2cqh;
|
text-align: center;
|
||||||
padding-bottom: 2cqh;
|
|
||||||
border-bottom: var(--border-width) solid var(--border-hairline);
|
|
||||||
|
|
||||||
min-width: 0;
|
border-bottom: var(--border-width) solid var(--border-hairline);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gain-panel .gain-panel__btn {
|
||||||
|
width: 85%;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 2cqh 0;
|
||||||
|
font-size: 4cqh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Graphs ---------- */
|
||||||
|
|
||||||
.gain-linear-graph-section {
|
.gain-linear-graph-section {
|
||||||
flex: 0 0 calc(100% - var(--dsp-control-heigth));
|
flex: 0 0 calc(100% - var(--dsp-control-heigth));
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -94,17 +124,6 @@
|
|||||||
border-radius: var(--radius-md);
|
border-radius: var(--radius-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
.gain-graph-title {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
padding: 1cqh;
|
|
||||||
|
|
||||||
font-family: var(--font-ui);
|
|
||||||
font-size: 2.5cqh;
|
|
||||||
font-weight: var(--font-weight-semibold);
|
|
||||||
}
|
|
||||||
|
|
||||||
.gain-graph-panel > .container {
|
.gain-graph-panel > .container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -112,42 +131,49 @@
|
|||||||
|
|
||||||
.gain-graph-title-row {
|
.gain-graph-title-row {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
|
||||||
gap: 0.75cqh;
|
gap: 0.75cqh;
|
||||||
padding: 1cqh 1.5cqh;
|
|
||||||
|
|
||||||
min-width: 0;
|
padding: 1cqh 1.5cqh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First row: title left, Show stages right */
|
/* Title left, "Show stages" right */
|
||||||
.gain-graph-title-line {
|
.gain-graph-title-line {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
gap: 1cqh;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
gap: 1cqh;
|
}
|
||||||
|
|
||||||
|
.gain-graph-title {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
padding: 1cqh;
|
||||||
|
|
||||||
|
font-family: var(--font-ui);
|
||||||
|
font-size: 2.5cqh;
|
||||||
|
font-weight: var(--font-weight-semibold);
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gain-graph-title-line .gain-graph-title {
|
.gain-graph-title-line .gain-graph-title {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compact button on the right */
|
|
||||||
.gain-stages-toggle {
|
.gain-stages-toggle {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
|
|
||||||
@@ -157,11 +183,11 @@
|
|||||||
padding: 0.4cqh 1cqh;
|
padding: 0.4cqh 1cqh;
|
||||||
font-size: 1.8cqh;
|
font-size: 1.8cqh;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Channel Selector */
|
/* ---------- Channel selector ---------- */
|
||||||
|
|
||||||
.magnitude-selector {
|
.magnitude-selector {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@@ -169,7 +195,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
gap: 0.5cqh;
|
gap: 0.5cqh;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -183,24 +208,21 @@
|
|||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
gap: 0.6cqh;
|
gap: 0.6cqh;
|
||||||
|
|
||||||
font-family: var(--font-ui);
|
|
||||||
font-size: 1.8cqh;
|
|
||||||
|
|
||||||
padding: 0.4cqh 1cqh;
|
padding: 0.4cqh 1cqh;
|
||||||
|
|
||||||
|
font-family: var(--font-ui);
|
||||||
|
font-size: 1.8cqh;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
background: var(--bg-void);
|
background: var(--bg-void);
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
|
|
||||||
border: var(--border-width) solid var(--border-hairline);
|
border: var(--border-width) solid var(--border-hairline);
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
|
|
||||||
cursor: pointer;
|
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,19 +233,384 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.magnitude-selector__swatch {
|
.magnitude-selector__swatch {
|
||||||
|
flex: 0 0 auto;
|
||||||
width: 1.2cqh;
|
width: 1.2cqh;
|
||||||
height: 1.2cqh;
|
height: 1.2cqh;
|
||||||
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: var(--chip-color);
|
background: var(--chip-color);
|
||||||
|
|
||||||
flex: 0 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.magnitude-selector__label {
|
.magnitude-selector__label {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
}
|
||||||
|
|
||||||
|
/* ---------- Phone (shared) ----------
|
||||||
|
Landscape: tabs (Faders / Input curve / Output curve), one view at a time.
|
||||||
|
Portrait: faders only + a hint to rotate for the graphs. */
|
||||||
|
|
||||||
|
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
|
||||||
|
.gain-page {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: var(--bg-panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- Tabs ----- */
|
||||||
|
|
||||||
|
.gain-tabs {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: flex;
|
||||||
|
gap: var(--space-1);
|
||||||
|
padding: var(--space-1) var(--space-2);
|
||||||
|
border-bottom: var(--border-width) solid var(--border-hairline);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-page .gain-tabs__tab {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 0;
|
||||||
|
height: 34px;
|
||||||
|
padding: 0 var(--space-2);
|
||||||
|
|
||||||
|
font-family: var(--font-ui);
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
font-weight: var(--font-weight-semibold);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
background: var(--bg-void);
|
||||||
|
color: var(--text-muted);
|
||||||
|
border: var(--border-width) solid var(--border-hairline);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-page .gain-tabs__tab[aria-selected='true'] {
|
||||||
|
background: var(--bg-raised);
|
||||||
|
color: var(--text-primary);
|
||||||
|
border-color: var(--accent-brand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- Which view is visible ----- */
|
||||||
|
|
||||||
|
.gain-page[data-view='faders'] .gain-linear-graph-section,
|
||||||
|
.gain-page:not([data-view='faders']) .gain-section,
|
||||||
|
.gain-page[data-view='input'] .gain-graph-panel[data-panel='output'],
|
||||||
|
.gain-page[data-view='output'] .gain-graph-panel[data-panel='input'] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- Curve views: graph fills everything ----- */
|
||||||
|
|
||||||
|
.gain-linear-graph-section {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0;
|
||||||
|
padding: var(--space-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-graph-panel {
|
||||||
|
flex: 1 1 0;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compact header: chips scroll on the left, "Show stages" on the right */
|
||||||
|
.gain-graph-title-row {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-2);
|
||||||
|
padding: var(--space-1) var(--space-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-graph-title-line {
|
||||||
|
order: 2;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-graph-title-line .gain-graph-title {
|
||||||
|
display: none; /* the tab already says which graph this is */
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-stages-toggle {
|
||||||
|
min-height: 0;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 var(--space-3);
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.magnitude-selector {
|
||||||
|
order: 1;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: auto;
|
||||||
|
gap: var(--space-1);
|
||||||
|
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scrollbar-width: none;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.magnitude-selector::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.magnitude-selector__chip {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-height: 0;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 var(--space-3);
|
||||||
|
gap: var(--space-2);
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.magnitude-selector__swatch {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- Faders view: mixer strips, swipe sideways, snap per group ----- */
|
||||||
|
|
||||||
|
.gain-section {
|
||||||
|
position: relative;
|
||||||
|
z-index: auto;
|
||||||
|
flex: 1 1 0;
|
||||||
|
height: auto;
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
align-items: stretch;
|
||||||
|
justify-content: flex-start;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panels {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
gap: var(--space-3);
|
||||||
|
padding: var(--space-2);
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scroll-snap-type: x proximity;
|
||||||
|
overscroll-behavior-x: contain;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin: 0;
|
||||||
|
padding: 30px var(--space-2) var(--space-2);
|
||||||
|
scroll-snap-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__label {
|
||||||
|
top: 7px;
|
||||||
|
font-size: var(--font-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__items {
|
||||||
|
height: auto;
|
||||||
|
align-self: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: clamp(64px, 10vw, 80px);
|
||||||
|
height: auto; /* stretches to the row */
|
||||||
|
aspect-ratio: auto;
|
||||||
|
gap: var(--space-2);
|
||||||
|
padding-bottom: var(--space-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__title {
|
||||||
|
padding-block: var(--space-2);
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The fader (element right after the title) takes all remaining height.
|
||||||
|
pan-x: vertical drags move the fader, horizontal swipes still scroll the strip. */
|
||||||
|
.gain-panel__title + * {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Applied to the thumb/track too: a swipe that starts on them must scroll the
|
||||||
|
strip, not drag the fader. */
|
||||||
|
.gain-panel__title + *,
|
||||||
|
.gain-panel__title + * * {
|
||||||
|
touch-action: pan-x !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Centered when everything fits, left-aligned and scrollable when it doesn't
|
||||||
|
(auto margins collapse to 0 on overflow, unlike justify-content: center) */
|
||||||
|
.gain-panels > .channel-group:first-child {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panels > .channel-group:last-child {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__btns {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-2);
|
||||||
|
width: calc(100% - var(--space-3));
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel .gain-panel__btns .gain-panel__btn {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 0;
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Portrait phone: faders only, 2 rows (Input on top, Output below) ---------- */
|
||||||
|
|
||||||
|
@media (max-width: 768px) and (orientation: portrait) {
|
||||||
|
.gain-tabs {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-rotate-hint {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: block;
|
||||||
|
padding: var(--space-2) var(--space-3);
|
||||||
|
|
||||||
|
font-family: var(--font-ui);
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-muted);
|
||||||
|
|
||||||
|
border-bottom: var(--border-width) solid var(--border-hairline);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Whatever tab was active in landscape, portrait always shows the faders */
|
||||||
|
.gain-page[data-view] .gain-linear-graph-section {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-page[data-view] .gain-section {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Two rows: each group is a row that scrolls sideways on its own */
|
||||||
|
.gain-panels {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--space-2);
|
||||||
|
overflow: hidden;
|
||||||
|
scroll-snap-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Each row is its own size container: everything sized in cqh inside
|
||||||
|
(fader thumb, track, readout) scales to the row height, like in landscape,
|
||||||
|
instead of to the whole screen. */
|
||||||
|
.gain-section .channel-group {
|
||||||
|
container-type: size;
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 28px var(--space-2) var(--space-2);
|
||||||
|
scroll-snap-align: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__label {
|
||||||
|
top: 6px;
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__items {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
gap: var(--space-1);
|
||||||
|
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
scroll-snap-type: x proximity;
|
||||||
|
overscroll-behavior-x: contain;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__items > :first-child {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__items > :last-child {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Same strip as landscape: narrow, compact, buttons stacked */
|
||||||
|
.gain-panel {
|
||||||
|
width: clamp(60px, 17vw, 72px);
|
||||||
|
gap: var(--space-1);
|
||||||
|
padding-bottom: var(--space-1);
|
||||||
|
scroll-snap-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__title {
|
||||||
|
padding-block: var(--space-1);
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__btns {
|
||||||
|
gap: var(--space-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel .gain-panel__btns .gain-panel__btn {
|
||||||
|
min-height: 36px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Landscape phone: thinner strips, buttons stacked ---------- */
|
||||||
|
|
||||||
|
@media (max-height: 500px) and (pointer: coarse) {
|
||||||
|
.gain-panels {
|
||||||
|
padding: var(--space-1) var(--space-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group {
|
||||||
|
padding-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-section .channel-group__label {
|
||||||
|
top: 4px;
|
||||||
|
font-size: var(--font-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel {
|
||||||
|
width: clamp(56px, 7.5vw, 76px);
|
||||||
|
gap: var(--space-1);
|
||||||
|
padding-bottom: var(--space-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__title {
|
||||||
|
padding-block: var(--space-1);
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel__btns {
|
||||||
|
gap: var(--space-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.gain-panel .gain-panels .gain-panel__btn,
|
||||||
|
.gain-panel .gain-panel__btns .gain-panel__btn {
|
||||||
|
min-height: 36px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,34 @@ import { getPeqCurvePoints } from '../../utils/graph/peq';
|
|||||||
import { getCrossoverCurvePoints } from '../../utils/graph/crossover';
|
import { getCrossoverCurvePoints } from '../../utils/graph/crossover';
|
||||||
import { ChannelCurves, formatY, ResponseGraph } from './GainGraph';
|
import { ChannelCurves, formatY, ResponseGraph } from './GainGraph';
|
||||||
|
|
||||||
|
// ---- Helpers ------------------------------------------------------------
|
||||||
|
|
||||||
|
type GainView = 'faders' | 'input' | 'output';
|
||||||
|
|
||||||
|
const GAIN_VIEWS: { id: GainView; label: string }[] = [
|
||||||
|
{ id: 'faders', label: 'Faders' },
|
||||||
|
{ id: 'input', label: 'Input curve' },
|
||||||
|
{ id: 'output', label: 'Output curve' },
|
||||||
|
];
|
||||||
|
|
||||||
|
function toggleInSet<T>(set: Set<T>, value: T): Set<T> {
|
||||||
|
const next = new Set(set);
|
||||||
|
if (next.has(value)) next.delete(value);
|
||||||
|
else next.add(value);
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
function withLiveValue<K extends string | number>(
|
||||||
|
prev: Partial<Record<K, number>>,
|
||||||
|
key: K,
|
||||||
|
value: number | null
|
||||||
|
): Partial<Record<K, number>> {
|
||||||
|
const next = { ...prev };
|
||||||
|
if (value === null) delete next[key];
|
||||||
|
else next[key] = value;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Curve construction -----------------------------------------------
|
// ---- Curve construction -----------------------------------------------
|
||||||
|
|
||||||
function getGainCurvePoints(freqs: number[], gainDb: number): CurvePoint[] {
|
function getGainCurvePoints(freqs: number[], gainDb: number): CurvePoint[] {
|
||||||
@@ -131,15 +159,9 @@ function GainPanel({
|
|||||||
await setInverse(channel, !inverted);
|
await setInverse(channel, !inverted);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLiveValue = (value: number) => {
|
|
||||||
onLiveGain(value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const commitGain = async (value: number) => {
|
const commitGain = async (value: number) => {
|
||||||
const success = await setGain(channel, value);
|
const success = await setGain(channel, value);
|
||||||
if (success) {
|
if (success) onLiveGain(null);
|
||||||
onLiveGain(null);
|
|
||||||
}
|
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,42 +176,29 @@ function GainPanel({
|
|||||||
unit=" dB"
|
unit=" dB"
|
||||||
value={gain}
|
value={gain}
|
||||||
formatValue={(v, d) => (v > 0 ? `+${v.toFixed(d)}` : v.toFixed(d))}
|
formatValue={(v, d) => (v > 0 ? `+${v.toFixed(d)}` : v.toFixed(d))}
|
||||||
onInput={handleLiveValue}
|
onInput={onLiveGain}
|
||||||
onChange={commitGain}
|
onChange={commitGain}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<div className="gain-panel__btns">
|
||||||
variant="toggle"
|
<Button
|
||||||
className={muted ? 'active-danger' : ''}
|
variant="toggle"
|
||||||
onClick={toggleMute}
|
className={`gain-panel__btn${muted ? ' active-danger' : ''}`}
|
||||||
style={{
|
onClick={toggleMute}
|
||||||
width: '85%',
|
>
|
||||||
paddingLeft: 0,
|
<span className="gain-panel__btn-long">{muted ? 'Muted' : 'Mute'}</span>
|
||||||
paddingRight: 0,
|
<span className="gain-panel__btn-short">Mute</span>
|
||||||
fontSize: '4cqh',
|
</Button>
|
||||||
paddingTop: '2cqh',
|
|
||||||
paddingBottom: '2cqh',
|
<Button
|
||||||
minHeight: 0,
|
variant="toggle"
|
||||||
}}
|
className={`gain-panel__btn${inverted ? ' active-warning' : ''}`}
|
||||||
>
|
onClick={toggleInverse}
|
||||||
{muted ? 'Muted' : 'Mute '}
|
>
|
||||||
</Button>
|
<span className="gain-panel__btn-long">{inverted ? 'Inverted' : 'Invert'}</span>
|
||||||
<Button
|
<span className="gain-panel__btn-short">Inv</span>
|
||||||
variant="toggle"
|
</Button>
|
||||||
className={inverted ? 'active-warning' : ''}
|
</div>
|
||||||
onClick={toggleInverse}
|
|
||||||
style={{
|
|
||||||
width: '85%',
|
|
||||||
paddingLeft: 0,
|
|
||||||
paddingRight: 0,
|
|
||||||
fontSize: '4cqh',
|
|
||||||
paddingTop: '2cqh',
|
|
||||||
paddingBottom: '2cqh',
|
|
||||||
minHeight: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{inverted ? 'Inverted' : 'Invert'}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -241,7 +250,11 @@ function GainSection({
|
|||||||
setInverse: (channel: Channel, inverted: boolean) => Promise<boolean>;
|
setInverse: (channel: Channel, inverted: boolean) => Promise<boolean>;
|
||||||
}) {
|
}) {
|
||||||
const [selectedInputs, setSelectedInputs] = useState<Set<InputChannel>>(new Set(INPUT_ORDER));
|
const [selectedInputs, setSelectedInputs] = useState<Set<InputChannel>>(new Set(INPUT_ORDER));
|
||||||
const [selectedOutputs, setSelectedOutputs] = useState<Set<OutputChannel>>(new Set(OUTPUT_ORDER));
|
const [selectedOutputs, setSelectedOutputs] = useState<Set<OutputChannel>>(
|
||||||
|
new Set(OUTPUT_ORDER)
|
||||||
|
);
|
||||||
|
|
||||||
|
const [view, setView] = useState<GainView>('faders');
|
||||||
|
|
||||||
const [showInputStages, setShowInputStages] = useState(false);
|
const [showInputStages, setShowInputStages] = useState(false);
|
||||||
const [showOutputStages, setShowOutputStages] = useState(false);
|
const [showOutputStages, setShowOutputStages] = useState(false);
|
||||||
@@ -251,70 +264,54 @@ function GainSection({
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
const setLiveInputGain = (channel: InputChannel, value: number | null) => {
|
const setLiveInputGain = (channel: InputChannel, value: number | null) =>
|
||||||
setLiveInputGains((prev) => {
|
setLiveInputGains((prev) => withLiveValue(prev, channel, value));
|
||||||
if (value === null) {
|
|
||||||
const next = { ...prev };
|
|
||||||
delete next[channel];
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
return { ...prev, [channel]: value };
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setLiveOutputGain = (channel: OutputChannel, value: number | null) => {
|
const setLiveOutputGain = (channel: OutputChannel, value: number | null) =>
|
||||||
setLiveOutputGains((prev) => {
|
setLiveOutputGains((prev) => withLiveValue(prev, channel, value));
|
||||||
if (value === null) {
|
|
||||||
const next = { ...prev };
|
|
||||||
delete next[channel];
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
return { ...prev, [channel]: value };
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const inputLabels: Record<InputChannel, string> = INPUT_ORDER.reduce(
|
const inputStates = dsp.state.current_config.input_states;
|
||||||
(acc, channel) => ({
|
const outputStates = dsp.state.current_config.output_states;
|
||||||
...acc,
|
|
||||||
[channel]: dsp.state.current_config.input_states[channel].name,
|
|
||||||
}),
|
|
||||||
{} as Record<InputChannel, string>
|
|
||||||
);
|
|
||||||
|
|
||||||
const outputLabels: Record<OutputChannel, string> = OUTPUT_ORDER.reduce(
|
const inputLabels = Object.fromEntries(
|
||||||
(acc, channel) => ({
|
INPUT_ORDER.map((channel) => [channel, inputStates[channel].name])
|
||||||
...acc,
|
) as Record<InputChannel, string>;
|
||||||
[channel]: dsp.state.current_config.output_states[channel].name,
|
|
||||||
}),
|
|
||||||
{} as Record<OutputChannel, string>
|
|
||||||
);
|
|
||||||
|
|
||||||
const toggleInput = (channel: InputChannel) => {
|
const outputLabels = Object.fromEntries(
|
||||||
setSelectedInputs((prev) => {
|
OUTPUT_ORDER.map((channel) => [channel, outputStates[channel].name])
|
||||||
const next = new Set(prev);
|
) as Record<OutputChannel, string>;
|
||||||
next.has(channel) ? next.delete(channel) : next.add(channel);
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleOutput = (channel: OutputChannel) => {
|
|
||||||
setSelectedOutputs((prev) => {
|
|
||||||
const next = new Set(prev);
|
|
||||||
next.has(channel) ? next.delete(channel) : next.add(channel);
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="gain-page" data-view={view}>
|
||||||
|
{/* Phone only (hidden on desktop by CSS): one view at a time */}
|
||||||
|
<div className="gain-tabs" role="tablist" aria-label="Gain views">
|
||||||
|
{GAIN_VIEWS.map((v) => (
|
||||||
|
<button
|
||||||
|
key={v.id}
|
||||||
|
type="button"
|
||||||
|
role="tab"
|
||||||
|
aria-selected={view === v.id}
|
||||||
|
className="gain-tabs__tab"
|
||||||
|
onClick={() => setView(v.id)}
|
||||||
|
>
|
||||||
|
{v.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Portrait phone only (CSS): graphs need the width of landscape */}
|
||||||
|
<div className="gain-rotate-hint">
|
||||||
|
Rotate your phone to landscape to see the response graphs.
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="gain-linear-graph-section">
|
<div className="gain-linear-graph-section">
|
||||||
<div className="gain-graph-panel">
|
<div className="gain-graph-panel" data-panel="input">
|
||||||
<div className="gain-graph-title-row">
|
<div className="gain-graph-title-row">
|
||||||
<div className="gain-graph-title-line">
|
<div className="gain-graph-title-line">
|
||||||
<div className="gain-graph-title">Input Response</div>
|
<div className="gain-graph-title">Input Response</div>
|
||||||
<Button
|
<Button
|
||||||
variant="toggle"
|
variant="toggle"
|
||||||
className={`gain-stages-toggle ${showInputStages ? 'active-info' : ''}`}
|
className={`gain-stages-toggle${showInputStages ? ' active-info' : ''}`}
|
||||||
onClick={() => setShowInputStages((v) => !v)}
|
onClick={() => setShowInputStages((v) => !v)}
|
||||||
>
|
>
|
||||||
Show stages
|
Show stages
|
||||||
@@ -325,12 +322,12 @@ function GainSection({
|
|||||||
labels={inputLabels}
|
labels={inputLabels}
|
||||||
colors={INPUT_COLORS}
|
colors={INPUT_COLORS}
|
||||||
selected={selectedInputs}
|
selected={selectedInputs}
|
||||||
onToggle={toggleInput}
|
onToggle={(c) => setSelectedInputs((prev) => toggleInSet(prev, c))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ResponseGraph
|
<ResponseGraph
|
||||||
channels={INPUT_ORDER}
|
channels={INPUT_ORDER}
|
||||||
states={dsp.state.current_config.input_states}
|
states={inputStates}
|
||||||
selected={selectedInputs}
|
selected={selectedInputs}
|
||||||
colors={INPUT_COLORS}
|
colors={INPUT_COLORS}
|
||||||
showStages={showInputStages}
|
showStages={showInputStages}
|
||||||
@@ -340,30 +337,29 @@ function GainSection({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="gain-graph-panel">
|
<div className="gain-graph-panel" data-panel="output">
|
||||||
<div className="gain-graph-title-row">
|
<div className="gain-graph-title-row">
|
||||||
<div className="gain-graph-title-line">
|
<div className="gain-graph-title-line">
|
||||||
<div className="gain-graph-title">Output Response</div>
|
<div className="gain-graph-title">Output Response</div>
|
||||||
<Button
|
<Button
|
||||||
variant={showOutputStages ? 'outline' : 'ghost'}
|
variant="toggle"
|
||||||
className="gain-stages-toggle"
|
className={`gain-stages-toggle${showOutputStages ? ' active-info' : ''}`}
|
||||||
onClick={() => setShowOutputStages((v) => !v)}
|
onClick={() => setShowOutputStages((v) => !v)}
|
||||||
>
|
>
|
||||||
Show stages
|
Show stages
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ChannelSelector
|
<ChannelSelector
|
||||||
channels={OUTPUT_ORDER}
|
channels={OUTPUT_ORDER}
|
||||||
labels={outputLabels}
|
labels={outputLabels}
|
||||||
colors={OUTPUT_COLORS}
|
colors={OUTPUT_COLORS}
|
||||||
selected={selectedOutputs}
|
selected={selectedOutputs}
|
||||||
onToggle={toggleOutput}
|
onToggle={(c) => setSelectedOutputs((prev) => toggleInSet(prev, c))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ResponseGraph
|
<ResponseGraph
|
||||||
channels={OUTPUT_ORDER}
|
channels={OUTPUT_ORDER}
|
||||||
states={dsp.state.current_config.output_states}
|
states={outputStates}
|
||||||
selected={selectedOutputs}
|
selected={selectedOutputs}
|
||||||
colors={OUTPUT_COLORS}
|
colors={OUTPUT_COLORS}
|
||||||
showStages={showOutputStages}
|
showStages={showOutputStages}
|
||||||
@@ -382,7 +378,7 @@ function GainSection({
|
|||||||
key={channel}
|
key={channel}
|
||||||
dsp={dsp}
|
dsp={dsp}
|
||||||
channel={{ Input: channel }}
|
channel={{ Input: channel }}
|
||||||
title={dsp.state.current_config.input_states[channel].name}
|
title={inputStates[channel].name}
|
||||||
setGain={setGain}
|
setGain={setGain}
|
||||||
setMute={setMute}
|
setMute={setMute}
|
||||||
setInverse={setInverse}
|
setInverse={setInverse}
|
||||||
@@ -397,7 +393,7 @@ function GainSection({
|
|||||||
key={channel}
|
key={channel}
|
||||||
dsp={dsp}
|
dsp={dsp}
|
||||||
channel={{ Output: channel }}
|
channel={{ Output: channel }}
|
||||||
title={dsp.state.current_config.output_states[channel].name}
|
title={outputStates[channel].name}
|
||||||
setGain={setGain}
|
setGain={setGain}
|
||||||
setMute={setMute}
|
setMute={setMute}
|
||||||
setInverse={setInverse}
|
setInverse={setInverse}
|
||||||
@@ -407,7 +403,7 @@ function GainSection({
|
|||||||
</ChannelGroup>
|
</ChannelGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user