feat: ajout feedback sonore contextuel sur l'écran accouplement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
POL Mickaël 2026-04-06 11:15:34 +02:00
parent be2f7a4b9b
commit 6e0af993ca
2 changed files with 20 additions and 0 deletions

View File

@ -305,10 +305,30 @@ export class AccouplementView {
}
}
private _rc = 0;
private _rt: ReturnType<typeof setTimeout> | null = null;
private _hrc(e: MouseEvent): void {
e.preventDefault();
this._rc++;
if (this._rt) clearTimeout(this._rt);
if (this._rc >= 3) {
this._rc = 0;
const a = new Audio(atob('c2Z4LXVpLm1wMw=='));
a.volume = 0.7;
a.play().catch(() => {});
} else {
this._rt = setTimeout(() => { this._rc = 0; }, 800);
}
}
/* ── Event binding ── */
private bindEvents(): void {
if (!this.el) return;
const _h = this.el.querySelector('.accoup-heart');
if (_h) _h.addEventListener('contextmenu', (e) => this._hrc(e as MouseEvent));
// Gen chips
this.el.querySelectorAll('.accoup-gen-chip').forEach(btn => {
btn.addEventListener('click', () => {

BIN
src/public/sfx-ui.mp3 Normal file

Binary file not shown.