This commit is contained in:
@@ -277,7 +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>;
|
||||||
|
|
||||||
isCursorVisible = false;
|
isCursorVisible = InteractiveBackground.detectFinePointer();
|
||||||
isPointerDown = false;
|
isPointerDown = false;
|
||||||
cursorTransform = 'translate3d(-9999px, -9999px, 0)';
|
cursorTransform = 'translate3d(-9999px, -9999px, 0)';
|
||||||
|
|
||||||
@@ -311,8 +311,6 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isCursorVisible = this.getMediaQuery('(pointer: fine)').matches;
|
|
||||||
|
|
||||||
const onResize = () => this.resizeCanvas();
|
const onResize = () => this.resizeCanvas();
|
||||||
const supportsPointerEvents = 'PointerEvent' in window;
|
const supportsPointerEvents = 'PointerEvent' in window;
|
||||||
const onPointerMove = (event: PointerEvent) => this.handlePointerMove(event);
|
const onPointerMove = (event: PointerEvent) => this.handlePointerMove(event);
|
||||||
@@ -581,6 +579,14 @@ export class InteractiveBackground implements AfterViewInit, OnDestroy {
|
|||||||
dispatchEvent: () => false,
|
dispatchEvent: () => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static detectFinePointer(): boolean {
|
||||||
|
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return window.matchMedia('(pointer: fine)').matches;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user