Improves timed prompt notification duration calculation

Refines notification display duration for timed prompts to handle both short and long delay intervals

Adjusts duration calculation to:
- Cap notifications at 500ms for very short delays
- Subtract 500ms from longer delays to prevent prompt overlap
- Ensures smoother user experience during prompt sequences
This commit is contained in:
AlexKucera committed 2025-10-24 13:36:26 +02:00
1 parent db641cfe9d
commit c698a19345
1 file changed
+3 -2
+3 -2
View File
@@ -169,8 +169,9 @@ export class TimedPromptsCommand {
const totalPrompts = this.promptQueue.length; const totalPrompts = this.promptQueue.length;
// Calculate notification duration: slightly less than delay to avoid overlap // Calculate notification duration: slightly less than delay to avoid overlap
// Subtract 500ms to allow for fade-out before next prompt appears // For very short delays (<=1s), cap at 500ms; otherwise end 500ms before next tick
const notificationDuration = Math.max(1000, (delaySeconds * 1000) - 500); const delayMs = delaySeconds * 1000;
const notificationDuration = delayMs > 1000 ? (delayMs - 500) : 500;
const notice = new Notice( const notice = new Notice(
`Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`, `Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,