Allow effect values at 0.1 precision
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.21 R86";
|
window.CHGRID_WEB_VERSION = "2026.02.21 R87";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export type EffectRuntime = {
|
|||||||
|
|
||||||
export function clampEffectLevel(value: number): number {
|
export function clampEffectLevel(value: number): number {
|
||||||
const clamped = Math.max(0, Math.min(100, value));
|
const clamped = Math.max(0, Math.min(100, value));
|
||||||
return Math.round(clamped / 5) * 5;
|
return Math.round(clamped * 10) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function disconnectEffectRuntime(runtime: EffectRuntime | null): void {
|
export function disconnectEffectRuntime(runtime: EffectRuntime | null): void {
|
||||||
|
|||||||
@@ -1831,8 +1831,8 @@ function handleItemPropertyEditModeInput(code: string, key: string): void {
|
|||||||
signaling.send({ type: 'item_update', itemId, params: { effect: normalized } });
|
signaling.send({ type: 'item_update', itemId, params: { effect: normalized } });
|
||||||
} else if (propertyKey === 'effectValue') {
|
} else if (propertyKey === 'effectValue') {
|
||||||
const parsed = Number(value);
|
const parsed = Number(value);
|
||||||
if (!Number.isInteger(parsed) || parsed < 0 || parsed > 100) {
|
if (!Number.isFinite(parsed) || parsed < 0 || parsed > 100) {
|
||||||
updateStatus('effectValue must be an integer between 0 and 100.');
|
updateStatus('effectValue must be a number between 0 and 100.');
|
||||||
audio.sfxUiCancel();
|
audio.sfxUiCancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ class SignalingServer:
|
|||||||
next_params["channel"] = channel
|
next_params["channel"] = channel
|
||||||
|
|
||||||
try:
|
try:
|
||||||
effect_value = int(next_params.get("effectValue", 50))
|
effect_value = float(next_params.get("effectValue", 50))
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
await self._send_item_result(client, False, "update", "effectValue must be a number.", item.id)
|
await self._send_item_result(client, False, "update", "effectValue must be a number.", item.id)
|
||||||
return
|
return
|
||||||
@@ -663,7 +663,7 @@ class SignalingServer:
|
|||||||
client, False, "update", "effectValue must be between 0 and 100.", item.id
|
client, False, "update", "effectValue must be between 0 and 100.", item.id
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
next_params["effectValue"] = round(effect_value / 5) * 5
|
next_params["effectValue"] = round(effect_value, 1)
|
||||||
item.params = next_params
|
item.params = next_params
|
||||||
item.updatedAt = self.item_service.now_ms()
|
item.updatedAt = self.item_service.now_ms()
|
||||||
item.version += 1
|
item.version += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user