Skip to content

Commit

Permalink
feat: valuesAsLabels - show min and max in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Nov 10, 2021
1 parent c93a0b0 commit a5489f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
11 changes: 8 additions & 3 deletions client/components/ChanStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ class ChanStrip extends React.PureComponent<
{window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label ?? ''}
<div className="parameter-mini-text">
{maxLabel + valueLabel}
{!valueAsLabels
? maxLabel + valueLabel
: valueAsLabels[valueAsLabels.length - 1] + valueLabel}
</div>
<ReactSlider
className="chan-strip-fader"
Expand All @@ -267,7 +269,8 @@ class ChanStrip extends React.PureComponent<
)
: valueAsLabels[
Math.round(
parseFloat(state.valueNow) * (maxLabel - minLabel)
parseFloat(state.valueNow) *
(maxLabel - minLabel)
)
]}
{valueLabel}
Expand All @@ -278,7 +281,9 @@ class ChanStrip extends React.PureComponent<
}}
/>
<div className="parameter-mini-text">
{minLabel + valueLabel}
{!valueAsLabels
? minLabel + valueLabel
: valueAsLabels[0] + valueLabel}
</div>
</div>
)
Expand Down
34 changes: 18 additions & 16 deletions client/components/ChanStripFull.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,42 +589,42 @@ class ChanStripFull extends React.PureComponent<
let valueLabel =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueLabel ?? ''

let valueAsLabels =
window.mixerProtocol.channelTypes[0].fromMixer[fxParam]?.[0]
.valueAsLabels
return (
<div className="parameter-text">
{
window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label
}
{window.mixerProtocol.channelTypes[0].fromMixer[fxParam][0]
.label ?? ''}
<div className="parameter-mini-text">
{maxLabel + valueLabel}
{!valueAsLabels
? maxLabel + valueLabel
: valueAsLabels[valueAsLabels.length - 1] + valueLabel}
</div>
<ReactSlider
className="chan-strip-full-fader"
thumbClassName="chan-strip-full-thumb"
className="chan-strip-fader"
thumbClassName="chan-strip-thumb"
orientation="vertical"
invert
min={0}
max={1}
step={0.001}
invert="false"
value={
this.props.fader[this.props.faderIndex][fxParam]?.[0] ??
0
}
renderThumb={(props: any, state: any) => (
<div {...props}>
{!window.mixerProtocol.channelTypes[0].fromMixer[
fxParam
]?.[0].valueAsLabels
{!valueAsLabels
? Math.round(
(maxLabel - minLabel) *
parseFloat(state.valueNow) +
minLabel
)
: window.mixerProtocol.channelTypes[0]
.fromMixer[fxParam]?.[0].valueAsLabels[
: valueAsLabels[
Math.round(
parseFloat(state.valueNow) * 10
parseFloat(state.valueNow) *
(maxLabel - minLabel)
)
]}
{valueLabel}
Expand All @@ -635,7 +635,9 @@ class ChanStripFull extends React.PureComponent<
}}
/>
<div className="parameter-mini-text">
{minLabel + valueLabel}
{!valueAsLabels
? minLabel + valueLabel
: valueAsLabels[0] + valueLabel}
</div>
</div>
)
Expand Down

0 comments on commit a5489f8

Please sign in to comment.