mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-20 07:43:48 +08:00
teeny slider
This commit is contained in:
@@ -104,11 +104,24 @@
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.sentry-range-value {
|
||||
.sentry-number-input {
|
||||
background: var(--sidebar-bg);
|
||||
border: var(--border-style-main);
|
||||
border-radius: var(--border-radius-sm);
|
||||
box-sizing: border-box;
|
||||
color: var(--text-color);
|
||||
font-variant-numeric: tabular-nums;
|
||||
min-width: 3.5rem;
|
||||
text-align: right;
|
||||
padding: 0.55rem 0.45rem;
|
||||
width: 5.5rem;
|
||||
}
|
||||
|
||||
.sentry-number-input:focus {
|
||||
border-color: var(--main-fg);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.sentry-range-unit {
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sentry-toggle {
|
||||
|
||||
@@ -282,12 +282,21 @@ export function SentryMode() {
|
||||
type="range"
|
||||
min="0.005"
|
||||
max="1"
|
||||
step="0.005"
|
||||
step="0.001"
|
||||
value="${() => numericParam("SentryModeSensitivity", 0.04)}"
|
||||
disabled="${() => state.savingKey === "SentryModeSensitivity"}"
|
||||
aria-label="Motion sensitivity"
|
||||
@change="${(event) => saveParam("SentryModeSensitivity", Number(event.currentTarget.value))}" />
|
||||
<output class="sentry-range-value">${() => numericParam("SentryModeSensitivity", 0.04).toFixed(3)}</output>
|
||||
<input
|
||||
class="sentry-number-input"
|
||||
type="number"
|
||||
min="0.005"
|
||||
max="1"
|
||||
step="0.001"
|
||||
value="${() => numericParam("SentryModeSensitivity", 0.04)}"
|
||||
disabled="${() => state.savingKey === "SentryModeSensitivity"}"
|
||||
aria-label="Exact motion sensitivity"
|
||||
@change="${(event) => saveParam("SentryModeSensitivity", Number(event.currentTarget.value))}" />
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@@ -304,7 +313,17 @@ export function SentryMode() {
|
||||
disabled="${() => state.savingKey === "SentryModeWarningTime"}"
|
||||
aria-label="Warning persistence"
|
||||
@change="${(event) => saveParam("SentryModeWarningTime", Number(event.currentTarget.value))}" />
|
||||
<output class="sentry-range-value">${() => numericParam("SentryModeWarningTime", 1).toFixed(1)}s</output>
|
||||
<input
|
||||
class="sentry-number-input"
|
||||
type="number"
|
||||
min="0.1"
|
||||
max="10"
|
||||
step="0.1"
|
||||
value="${() => numericParam("SentryModeWarningTime", 1)}"
|
||||
disabled="${() => state.savingKey === "SentryModeWarningTime"}"
|
||||
aria-label="Exact warning persistence"
|
||||
@change="${(event) => saveParam("SentryModeWarningTime", Number(event.currentTarget.value))}" />
|
||||
<span class="sentry-range-unit">seconds</span>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ PULSE_GLIDE_BUTTON_KEYS = {
|
||||
"StarButtonControl", "LongStarButtonControl", "VeryLongStarButtonControl",
|
||||
}
|
||||
SENTRY_NUMERIC_PARAM_BOUNDS = {
|
||||
"SentryModeSensitivity": (0.005, 1.0, 0.005),
|
||||
"SentryModeWarningTime": (0.1, 10.0, 0.1),
|
||||
"SentryModeSensitivity": (0.005, 1.0),
|
||||
"SentryModeWarningTime": (0.1, 10.0),
|
||||
}
|
||||
|
||||
GALAXY_DEPS_PATH = "/data/galaxy_deps"
|
||||
@@ -4913,14 +4913,13 @@ def setup(app):
|
||||
return jsonify({"error": "Pulse and Glide is available only with Galaxy Developer Mode enabled."}), 403
|
||||
|
||||
if key in SENTRY_NUMERIC_PARAM_BOUNDS:
|
||||
minimum, maximum, step = SENTRY_NUMERIC_PARAM_BOUNDS[key]
|
||||
minimum, maximum = SENTRY_NUMERIC_PARAM_BOUNDS[key]
|
||||
try:
|
||||
numeric = float(data["value"])
|
||||
except (TypeError, ValueError):
|
||||
return jsonify({"error": f"{key} must be numeric."}), 400
|
||||
if not math.isfinite(numeric) or numeric < minimum or numeric > maximum:
|
||||
return jsonify({"error": f"{key} must be between {minimum} and {maximum}."}), 400
|
||||
numeric = round(round(numeric / step) * step, 3)
|
||||
str_val = str(numeric)
|
||||
|
||||
if key == "AlphaLongitudinalEnabled":
|
||||
|
||||
Reference in New Issue
Block a user