Files
Febe/src/Febe.Browser/Gestures/GestureSettings.cs
T
Alby96andClaude Opus 5.5 9941a2fa1f
verifica / controlli (push) Successful in 20s
verifica / prove (push) Failing after 19m40s
verifica / installatore (push) Skipped
verifica / immagine (push) Skipped
Ricerca dei profili con suggerimenti e foto (#37)
«Aggiungi account» ha una sola casella: mentre Alberto scrive compaiono
subito i suggerimenti locali, poi i profili di Instagram con la foto, come
chiesto in #37. Il browser di Febe scrive nella casella «Cerca» di Instagram
con tasti veri da una mappa chiusa (mai Invio, Tab o Esc), controlla prima
il fuoco, legge la risposta della pagina e non clicca mai un risultato.

La ricerca ha una categoria propria nel Governatore, con tetti larghi che
non consumano quelli della raccolta, e si dà il turno con il motore
sull'unica pagina; a fine sessione la pagina torna comunque al riposo. Le
foto passano dal CDN con un permesso ciascuna e restano solo in memoria.

Le risposte di Alberto del 15 novembre (controllo del fuoco, turni, evento
requestWillBeSent, niente foto dei seguiti per ora) sono in §6.1 e in
docs/decisioni.md. Su Instagram vero la ricerca parte quando i bersagli
search-open e search-box saranno raccolti dal vivo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:30:03 +01:00

95 lines
4.1 KiB
C#

namespace Febe.Browser.Gestures;
/// <summary>A point in CSS pixels relative to the page viewport (the coordinate space of <c>Input.*</c>).</summary>
public readonly record struct PagePoint(double X, double Y)
{
public double DistanceTo(PagePoint other) => Math.Sqrt(((X - other.X) * (X - other.X)) + ((Y - other.Y) * (Y - other.Y)));
}
/// <summary>A rectangle in CSS pixels relative to the page viewport.</summary>
public readonly record struct PageRect(double X, double Y, double Width, double Height)
{
public PagePoint Center => new(X + (Width / 2), Y + (Height / 2));
public double Right => X + Width;
public double Bottom => Y + Height;
public bool Contains(PagePoint p) => p.X >= X && p.X <= Right && p.Y >= Y && p.Y <= Bottom;
}
/// <summary>An interval «from a to b» with an optional median (spec §7.2), in the unit of its use.</summary>
public readonly record struct Interval(double Min, double Max, double? Median = null);
/// <summary>
/// Gesture timings for the «naturale» pace (spec §7.7). Every wait is multiplied by the session mood and by the
/// pace factor. Milliseconds unless stated otherwise.
/// </summary>
public sealed record GestureSettings
{
public static GestureSettings Natural { get; } = new();
/// <summary>Pointer travel time.</summary>
public Interval MoveDurationMs { get; init; } = new(250, 900);
/// <summary>Interval between pointer events: about 60 per second.</summary>
public double PointerEventIntervalMs { get; init; } = 1000.0 / 60.0;
/// <summary>Largest sideways bend of the path, as a fraction of the distance (a slightly curved path).</summary>
public Interval PathBendFraction { get; init; } = new(0.02, 0.12);
/// <summary>Part of the target, around its centre, where the pointer lands (0.6 = central 60% in each direction).</summary>
public double CentralFraction { get; init; } = 0.6;
/// <summary>Hover on the target before pressing.</summary>
public Interval HoverMs { get; init; } = new(80, 300);
/// <summary>Time between press and release.</summary>
public Interval PressMs { get; init; } = new(50, 140);
/// <summary>Wheel events in a burst.</summary>
public (int Min, int Max) WheelEventsPerBurst { get; init; } = (3, 8);
/// <summary>Pixels per wheel event.</summary>
public Interval WheelDeltaPx { get; init; } = new(80, 140);
/// <summary>Interval between the wheel events of a burst.</summary>
public Interval WheelIntervalMs { get; init; } = new(12, 40);
/// <summary>Pause between bursts.</summary>
public Interval BetweenBurstsMs { get; init; } = new(400, 4000, 1100);
/// <summary>Bursts between two reading pauses.</summary>
public (int Min, int Max) BurstsBeforeReading { get; init; } = (6, 10);
/// <summary>Reading pause.</summary>
public Interval ReadingPauseMs { get; init; } = new(3000, 20000, 6000);
/// <summary>Probability of a small scroll back after a burst.</summary>
public double ScrollBackProbability { get; init; } = 0.1;
/// <summary>Pixels per wheel event of a scroll back.</summary>
public Interval ScrollBackDeltaPx { get; init; } = new(40, 100);
/// <summary>Wait after a page load before the first gesture.</summary>
public Interval AfterLoadMs { get; init; } = new(1000, 6000, 2200);
/// <summary>Probability of a distraction after an action.</summary>
public double DistractionProbability { get; init; } = 0.08;
/// <summary>Length of a distraction.</summary>
public Interval DistractionMs { get; init; } = new(15000, 90000);
/// <summary>Gap between two keys while typing (issue #37), before mood and pace.</summary>
public Interval KeyGapMs { get; init; } = new(60, 250, 110);
/// <summary>How long a key is held down.</summary>
public Interval KeyHoldMs { get; init; } = new(40, 120);
/// <summary>Probability of a short hesitation before a key, as a person who thinks of the next letter.</summary>
public double TypingHesitationProbability { get; init; } = 0.03;
/// <summary>Length of such a hesitation, before mood and pace.</summary>
public Interval TypingHesitationMs { get; init; } = new(300, 900);
}