Improves notification duration calculation for timed prompts
Refines notification display timing logic to prevent flickering and ensure smoother user experience Adjusts notification duration calculation for short delays, using a more nuanced approach that: - Caps notification time at 900ms or delay-100ms for very short intervals - Maintains existing behavior for longer delays
This commit is contained in:
1 file changed
+3
-2
@@ -177,9 +177,10 @@ 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
|
||||||
// For very short delays (<=1s), cap at 500ms; otherwise end 500ms before next tick
|
// For very short delays (<=1s), use 900ms or delay-100ms (whichever is smaller)
|
||||||
|
// to prevent flicker; otherwise end 500ms before next tick
|
||||||
const delayMs = delaySeconds * 1000;
|
const delayMs = delaySeconds * 1000;
|
||||||
const notificationDuration = delayMs > 1000 ? (delayMs - 500) : 500;
|
const notificationDuration = delayMs > 1000 ? (delayMs - 500) : Math.min(900, delayMs - 100);
|
||||||
|
|
||||||
const notice = new Notice(
|
const notice = new Notice(
|
||||||
`Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,
|
`Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,
|
||||||
|
|||||||
Reference in new issue
Block a user