Skip to content

Commit 8f2cf86

Browse files
committed
add fsr position indicators
1 parent 1fe76a1 commit 8f2cf86

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

ui/common/panel-meters.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function PanelMeters() {
1818
{ id: 3, activationThreshold: 80, releaseThreshold: 40 },
1919
{ id: 4, activationThreshold: 75, releaseThreshold: 25 },
2020
]);
21+
const isFsr = stage?.config?.flags.PlatformFlags_FSR;
2122

2223
const [isLocked, setIsLocked] = useState(false);
2324

@@ -68,12 +69,13 @@ export function PanelMeters() {
6869
<SensorMeterInput
6970
key={sensor.id}
7071
value={panelData?.sensor_level[index]}
71-
id={sensor.id}
72+
id={index}
7273
activationThreshold={sensor.activationThreshold}
7374
releaseThreshold={sensor.releaseThreshold}
7475
maxValue={255}
7576
updateThreshold={updateSensorThreshold}
7677
showControls={!isLocked || index === sensors.length - 1}
78+
forFsr={isFsr}
7779
/>
7880
))}
7981
</div>

ui/common/sensor-meter-input.module.css

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.root {
22
display: flex;
33
flex-direction: column;
4-
place-items: center;
4+
place-items: left;
5+
--meter-width: 64px;
56
}
67

78
.control {
@@ -12,7 +13,7 @@
1213

1314
.meterContainer {
1415
position: relative;
15-
width: 64px;
16+
width: var(--meter-width);
1617
height: 256px;
1718
background-color: var(--color-gray-200);
1819
border-radius: 5px;
@@ -81,6 +82,19 @@
8182
}
8283

8384
.bottomLabel {
84-
text-align: center;
85+
display: flex;
86+
flex-direction: column;
87+
width: var(--meter-width);
8588
font-size: 80%;
8689
}
90+
91+
.bottomLabel p {
92+
margin: 0.4em 0;
93+
}
94+
95+
.fsrIndicator {
96+
align-self: center;
97+
height: 2em;
98+
width: 2em;
99+
border: 1px solid var(--color-gray-500);
100+
}

ui/common/sensor-meter-input.tsx

+18-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface SensorProps {
1414
maxValue: number;
1515
updateThreshold?: (id: number, type: "activation" | "release", value: number) => void;
1616
showControls?: boolean;
17+
forFsr?: boolean;
1718
}
1819

1920
function useSensorActive(value: number, atk: number, rls: number) {
@@ -41,6 +42,7 @@ export function SensorMeterInput({
4142
activationThreshold,
4243
updateThreshold,
4344
showControls,
45+
forFsr,
4446
}: SensorProps) {
4547
const valuePct = (100 * (value || 0)) / maxValue;
4648
const releaseThresholdPct = (100 * releaseThreshold) / maxValue;
@@ -111,7 +113,22 @@ export function SensorMeterInput({
111113
</div>
112114
)}
113115
</div>
114-
<div className={classes.bottomLabel}>{value === undefined ? null : <p>Value: {value}</p>}</div>
116+
<div className={classes.bottomLabel}>
117+
{forFsr && <FsrIndicator index={id} />}
118+
<p>Value: {value === undefined ? "--" : value}</p>
119+
</div>
115120
</div>
116121
);
117122
}
123+
124+
const fsrSidesByIndex = ["Left", "Right", "Top", "Bottom"] as const;
125+
126+
function FsrIndicator({ index }: { index: number }) {
127+
const side = fsrSidesByIndex[index];
128+
return (
129+
<div
130+
className={classes.fsrIndicator}
131+
style={{ [`border${side}Width`]: "4px", [`border${side}Color`]: "var(--color-gray-700)" }}
132+
/>
133+
);
134+
}

0 commit comments

Comments
 (0)