fix: draw over bounds
This commit is contained in:
@@ -413,7 +413,7 @@ function GainSection({
|
||||
const { yMin: inputYMin, yMax: inputYMax } = computeYAxisBounds(
|
||||
inputCurves,
|
||||
GRAPH_Y_MIN,
|
||||
GRAPH_Y_MAX,
|
||||
12,
|
||||
Y_AXIS_STEP
|
||||
);
|
||||
const { yMin: outputYMin, yMax: outputYMax } = computeYAxisBounds(
|
||||
@@ -457,7 +457,18 @@ function GainSection({
|
||||
yLabel="dB"
|
||||
showGrid={true}
|
||||
formatX={(v) => Math.round(v).toString()}
|
||||
formatY={(v) => Math.round(v).toString()}
|
||||
formatY={(v) => {
|
||||
// Always label 0.
|
||||
if (v === 0) return '0';
|
||||
|
||||
// Positive side: label every 12 dB.
|
||||
if (v > 0) {
|
||||
return v % 12 === 0 ? `+${Math.round(v)}` : '';
|
||||
}
|
||||
|
||||
// Negative side: label every 15 dB.
|
||||
return Math.abs(v) % 15 === 0 ? Math.round(v).toString() : '';
|
||||
}}
|
||||
draw={({ ctx, toPx }) => {
|
||||
drawCurves({
|
||||
ctx,
|
||||
|
||||
Reference in New Issue
Block a user