fixed ring around click on button
All checks were successful
publish.yml / publish (push) Successful in 1m12s

This commit is contained in:
2026-04-15 23:23:26 +02:00
parent 0b2ea1f3bc
commit 92cf05a6ef

View File

@@ -1,4 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core'; import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild, inject } from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
type PointerState = { type PointerState = {
x: number; x: number;
@@ -276,6 +277,7 @@ class ParticleEngine {
}) })
export class InteractiveBackground implements AfterViewInit, OnDestroy { export class InteractiveBackground implements AfterViewInit, OnDestroy {
@ViewChild('canvas', { static: true }) private readonly canvasRef!: ElementRef<HTMLCanvasElement>; @ViewChild('canvas', { static: true }) private readonly canvasRef!: ElementRef<HTMLCanvasElement>;
private readonly router = inject(Router);
isCursorVisible = InteractiveBackground.detectFinePointer(); isCursorVisible = InteractiveBackground.detectFinePointer();
isPointerDown = false; isPointerDown = false;
@@ -330,6 +332,11 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
const onTouchCancel = () => this.handlePointerLeave(); const onTouchCancel = () => this.handlePointerLeave();
const onMotionChange = (event: MediaQueryListEvent) => this.handleMotionPreferenceChange(event.matches); const onMotionChange = (event: MediaQueryListEvent) => this.handleMotionPreferenceChange(event.matches);
const routerSubscription = this.router.events.subscribe((event) => {
if (event instanceof NavigationStart) {
this.resetPointerInteraction();
}
});
window.addEventListener('resize', onResize); window.addEventListener('resize', onResize);
@@ -368,6 +375,7 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
() => window.removeEventListener('touchend', onTouchEnd), () => window.removeEventListener('touchend', onTouchEnd),
() => window.removeEventListener('touchcancel', onTouchCancel), () => window.removeEventListener('touchcancel', onTouchCancel),
() => this.mediaQuery.removeEventListener('change', onMotionChange), () => this.mediaQuery.removeEventListener('change', onMotionChange),
() => routerSubscription.unsubscribe(),
]; ];
} }
@@ -452,11 +460,11 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
} }
this.activeTouchId = null; this.activeTouchId = null;
this.pointerActive = false; this.resetPointerInteraction();
return; return;
} }
this.updatePointer(event.clientX, event.clientY, true); this.resetPointerInteraction();
} }
private handleMouseMove(event: MouseEvent): void { private handleMouseMove(event: MouseEvent): void {
@@ -469,7 +477,7 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
} }
private handleMouseUp(): void { private handleMouseUp(): void {
this.isPointerDown = false; this.resetPointerInteraction();
} }
private handleTouchStart(event: TouchEvent): void { private handleTouchStart(event: TouchEvent): void {
@@ -507,11 +515,14 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
} }
this.isPointerDown = false; this.isPointerDown = false;
this.activeTouchId = null; this.resetPointerInteraction();
this.pointerActive = false;
} }
private handlePointerLeave(): void { private handlePointerLeave(): void {
this.resetPointerInteraction();
}
private resetPointerInteraction(): void {
this.pointerActive = false; this.pointerActive = false;
this.isPointerDown = false; this.isPointerDown = false;
this.activeTouchId = null; this.activeTouchId = null;