refactor to define helper service more accurately
This commit is contained in:
1 parent
5527acfb6a
commit
7618e4bf5d
28 files changed
+78
-403
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import {AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, PLATFORM_ID, ViewChild, Input} from '@angular/core';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
import {ViewportService} from '../services/viewport.service';
|
||||
import {isPlatformBrowser} from '@angular/common';
|
||||
import Parallax from 'parallax-js';
|
||||
|
||||
@@ -16,17 +16,17 @@ export class ParallaxComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
@Input() bgGradient: string =
|
||||
'radial-gradient(circle 120vw at center, rgba(90,78,130,0.32), transparent 40%), linear-gradient(180deg,#1b172c 0%, #0b0b0f 100%)';
|
||||
|
||||
isMobile: boolean = false;
|
||||
isNarrow: boolean = false;
|
||||
private parallaxInstance: Parallax | null = null;
|
||||
|
||||
constructor(
|
||||
private deviceService: DeviceDetectorService,
|
||||
private deviceService: ViewportService,
|
||||
@Inject(PLATFORM_ID) private platformId: Object
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
this.isNarrow = this.deviceService.isNarrow;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -39,8 +39,8 @@ export class ParallaxComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
clipRelativeInput: true,
|
||||
calibrateX: true,
|
||||
calibrateY: true,
|
||||
scalarX: this.isMobile ? 6 : 12,
|
||||
scalarY: this.isMobile ? 6 : 12,
|
||||
scalarX: this.isNarrow ? 6 : 12,
|
||||
scalarY: this.isNarrow ? 6 : 12,
|
||||
frictionX: 0.1,
|
||||
frictionY: 0.1,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user