fix: performance and style
This commit is contained in:
@@ -442,7 +442,7 @@ describe('HomeComponent', (): void => {
|
||||
expect(comp.shouldEnableScrollEffects()).toBeTrue();
|
||||
});
|
||||
|
||||
it('should disable scroll effects on coarse touch pointers', (): void => {
|
||||
it('should keep scroll effects enabled on coarse touch pointers when motion is allowed', (): void => {
|
||||
spyOn(window, 'matchMedia').and.callFake(
|
||||
(query: string): MediaQueryList =>
|
||||
({
|
||||
@@ -450,7 +450,7 @@ describe('HomeComponent', (): void => {
|
||||
}) as MediaQueryList,
|
||||
);
|
||||
|
||||
expect(comp.shouldEnableScrollEffects()).toBeFalse();
|
||||
expect(comp.shouldEnableScrollEffects()).toBeTrue();
|
||||
});
|
||||
|
||||
it('should disable scroll effects when reduced motion is requested', (): void => {
|
||||
|
||||
@@ -233,22 +233,21 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
const prefersReducedMotion: boolean = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)',
|
||||
).matches;
|
||||
const usesTouchScrolling: boolean = window.matchMedia(
|
||||
'(hover: none) and (pointer: coarse)',
|
||||
).matches;
|
||||
|
||||
return !prefersReducedMotion && !usesTouchScrolling;
|
||||
return !prefersReducedMotion;
|
||||
}
|
||||
|
||||
private initNameGradientScrollAnimation(): void {
|
||||
if (!this.shouldEnableScrollEffects()) return;
|
||||
window.addEventListener('scroll', this.scheduleNameGradientUpdate, { passive: true });
|
||||
window.addEventListener('resize', this.scheduleNameGradientUpdate, { passive: true });
|
||||
this.scheduleNameGradientUpdate();
|
||||
}
|
||||
private initProjectEntryRevealObserver(): void {
|
||||
if (!this.shouldEnableScrollEffects()) return;
|
||||
window.addEventListener('scroll', this.scheduleProjectEntryRevealUpdate, { passive: true });
|
||||
window.addEventListener('resize', this.scheduleProjectEntryRevealUpdate, { passive: true });
|
||||
this.scheduleProjectEntryRevealUpdate();
|
||||
}
|
||||
private destroyProjectEntryRevealObserver(): void {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') return;
|
||||
@@ -270,6 +269,7 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
window.addEventListener('resize', this.scheduleAboutSectionScrollAnimationUpdate, {
|
||||
passive: true,
|
||||
});
|
||||
this.scheduleAboutSectionScrollAnimationUpdate();
|
||||
}
|
||||
private destroyAboutSectionScrollAnimation(): void {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') return;
|
||||
|
||||
+12
-11
@@ -1229,25 +1229,26 @@ hr {
|
||||
|
||||
@media (hover: none) and (pointer: coarse) {
|
||||
body {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(217, 162, 140, 0.18), transparent 28%),
|
||||
radial-gradient(circle at bottom right, rgba(127, 78, 63, 0.24), transparent 32%),
|
||||
linear-gradient(180deg, rgba(9, 9, 12, 0.72), rgba(8, 8, 11, 0.96)),
|
||||
url('assets/optimized/background.webp') center top / cover no-repeat;
|
||||
url('assets/optimized/background.webp') center / cover fixed no-repeat;
|
||||
}
|
||||
}
|
||||
|
||||
@media (hover: none) and (pointer: coarse) {
|
||||
.about-scroll-anim-enabled .story-copy,
|
||||
.about-scroll-anim-enabled .story-detail,
|
||||
.project-entry,
|
||||
.project-entry.project-entry-from-right,
|
||||
.project-entry.project-entry-from-left {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
will-change: auto;
|
||||
}
|
||||
|
||||
.action-link:hover,
|
||||
.detail-toggle:hover,
|
||||
.back-link:hover,
|
||||
|
||||
Reference in New Issue
Block a user