feat: Distance/Sample 슬라이더→숫자 직접 입력으로 변경
OutlinedTextField + Decimal 키보드로 정밀 입력 가능 범위: 0.5~5.0mm, 기본값 1.771mm 입력 즉시 PiezoHW.distancePerSample 반영 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+22
-12
@@ -662,22 +662,32 @@ fun PiezoMonitoringView(appState: AppState) {
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
// Distance Per Sample
|
||||
var currentDps by remember { mutableStateOf(PiezoHW.distancePerSample.toFloat()) }
|
||||
// Distance Per Sample (직접 입력)
|
||||
var dpsText by remember { mutableStateOf("%.3f".format(PiezoHW.distancePerSample)) }
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("Distance/Sample", fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text("${"%.3f".format(currentDps)} mm", fontSize = 14.sp, fontWeight = FontWeight.Bold, color = Color(0xFF4CAF50))
|
||||
OutlinedTextField(
|
||||
value = dpsText,
|
||||
onValueChange = { input ->
|
||||
dpsText = input
|
||||
input.toDoubleOrNull()?.let { v ->
|
||||
if (v in 0.5..5.0) PiezoHW.distancePerSample = v
|
||||
}
|
||||
},
|
||||
suffix = { Text("mm", fontSize = 12.sp, color = MlSecondaryText) },
|
||||
singleLine = true,
|
||||
keyboardOptions = androidx.compose.foundation.text.KeyboardOptions(
|
||||
keyboardType = androidx.compose.ui.text.input.KeyboardType.Decimal
|
||||
),
|
||||
modifier = Modifier.width(120.dp),
|
||||
textStyle = androidx.compose.ui.text.TextStyle(
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color(0xFF4CAF50)
|
||||
)
|
||||
)
|
||||
}
|
||||
Slider(
|
||||
value = currentDps,
|
||||
onValueChange = {
|
||||
currentDps = it
|
||||
PiezoHW.distancePerSample = it.toDouble()
|
||||
},
|
||||
valueRange = 1.5f..2.5f,
|
||||
colors = SliderDefaults.colors(thumbColor = Color(0xFF4CAF50), activeTrackColor = Color(0xFF4CAF50))
|
||||
)
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user