diff --git a/src-tauri/src/engine/worker.rs b/src-tauri/src/engine/worker.rs index a815845..f7c6f6a 100644 --- a/src-tauri/src/engine/worker.rs +++ b/src-tauri/src/engine/worker.rs @@ -414,7 +414,8 @@ pub fn start_clicker(config: ClickerConfig, control: RunControl) -> RunOutcome { } } - let per_tick_clicks = batch_size.saturating_mul(if config.double_click_enabled { 2 } else { 1 }); + let per_tick_clicks = + batch_size.saturating_mul(if config.double_click_enabled { 2 } else { 1 }); let requested_clicks = if config.sequence_enabled && !config.sequence_points.is_empty() { sequence_clicks_remaining.min(per_tick_clicks) } else { diff --git a/src/cadence.ts b/src/cadence.ts index 1ef3462..70468d6 100644 --- a/src/cadence.ts +++ b/src/cadence.ts @@ -56,6 +56,32 @@ export function getMaxDoubleClickDelayMs(settings: CadenceSettings): number { return cps > 0 ? Math.max(20, Math.floor(1000 / cps) - 2) : 9999; } +export function formatMillisecondsSummary(totalMs: number): string { + const roundedMs = Math.max(1, Math.round(totalMs)); + const hours = Math.floor(roundedMs / 3_600_000); + const remainderAfterHours = roundedMs % 3_600_000; + const minutes = Math.floor(remainderAfterHours / 60_000); + const remainderAfterMinutes = remainderAfterHours % 60_000; + const seconds = Math.floor(remainderAfterMinutes / 1_000); + const milliseconds = remainderAfterMinutes % 1_000; + const parts: string[] = []; + + if (hours > 0) { + parts.push(`${hours}h`); + } + if (minutes > 0) { + parts.push(`${minutes}m`); + } + if (seconds > 0) { + parts.push(`${seconds}s`); + } + if (milliseconds > 0 || parts.length === 0) { + parts.push(`${milliseconds}ms`); + } + + return parts.join(" "); +} + export function formatDurationSummary(settings: CadenceSettings): string { const parts: string[] = []; diff --git a/src/components/CadenceInput.tsx b/src/components/CadenceInput.tsx index e1e8bf4..719af9b 100644 --- a/src/components/CadenceInput.tsx +++ b/src/components/CadenceInput.tsx @@ -1,6 +1,10 @@ import type { ChangeEvent, CSSProperties, FocusEvent, WheelEvent } from "react"; import "./panels/advanced/AdvancedPanel.css"; -import { RATE_INPUT_MODE_OPTIONS } from "../cadence"; +import { + formatMillisecondsSummary, + getEffectiveIntervalMs, + RATE_INPUT_MODE_OPTIONS, +} from "../cadence"; import { normalizeIntegerRaw } from "../numberInput"; import type { RateInputMode, Settings } from "../store"; import { useTranslation } from "../i18n"; @@ -352,6 +356,9 @@ export default function CadenceInput({ settings, update, variant }: Props) { ))} ); + const rateCadenceDisplay = `${formatMillisecondsSummary( + getEffectiveIntervalMs(settings), + )} ${t("advanced.delay")}`; return (