diff --git a/apps/demo/src/app/config/config.component.html b/apps/demo/src/app/config/config.component.html
index 7328822..1a6f429 100644
--- a/apps/demo/src/app/config/config.component.html
+++ b/apps/demo/src/app/config/config.component.html
@@ -88,6 +88,15 @@
Responsive
+
diff --git a/apps/demo/src/app/config/config.component.scss b/apps/demo/src/app/config/config.component.scss
index f7494e6..bb17ab2 100644
--- a/apps/demo/src/app/config/config.component.scss
+++ b/apps/demo/src/app/config/config.component.scss
@@ -35,9 +35,10 @@
}
.others-form {
- border-top: 1px solid black;
+ align-items: center;
+ border-top: 1px solid lightgrey;
display: flex;
- justify-items: start;
+ justify-content: space-between;
padding: 1rem 0;
width: 100%;
}
diff --git a/apps/demo/src/app/config/config.component.ts b/apps/demo/src/app/config/config.component.ts
index 120ee81..5451310 100644
--- a/apps/demo/src/app/config/config.component.ts
+++ b/apps/demo/src/app/config/config.component.ts
@@ -17,6 +17,7 @@ import { MatSelectModule } from '@angular/material/select';
import { ConfigForm } from './config-form';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatCheckboxModule } from '@angular/material/checkbox';
+import { Clipboard } from '@angular/cdk/clipboard';
@Component({
selector: 'ngx-parallax-stars-config',
@@ -41,7 +42,10 @@ export class ConfigComponent implements OnInit {
@Output() configChanged = new EventEmitter();
- constructor(private fb: NonNullableFormBuilder) {
+ constructor(
+ private fb: NonNullableFormBuilder,
+ private clipboard: Clipboard
+ ) {
this.form = this.buildForm();
}
@@ -98,6 +102,11 @@ export class ConfigComponent implements OnInit {
this.registerFormChanges();
}
+ exportLayers(): void {
+ const layers = JSON.stringify(this.layers.getRawValue());
+ this.clipboard.copy(layers);
+ }
+
private registerFormChanges(): void {
this.form.valueChanges
.pipe(
diff --git a/apps/demo/src/app/main/main.component.scss b/apps/demo/src/app/main/main.component.scss
index 8a74515..66bc403 100644
--- a/apps/demo/src/app/main/main.component.scss
+++ b/apps/demo/src/app/main/main.component.scss
@@ -1,6 +1,5 @@
:host {
display: grid;
-
--margin: 3rem;
}
diff --git a/apps/demo/src/app/mouse-highlighter/mouse-highlighter.component.ts b/apps/demo/src/app/mouse-highlighter/mouse-highlighter.component.ts
index 4cfb335..db61003 100644
--- a/apps/demo/src/app/mouse-highlighter/mouse-highlighter.component.ts
+++ b/apps/demo/src/app/mouse-highlighter/mouse-highlighter.component.ts
@@ -1,4 +1,4 @@
-import { Component, ElementRef, OnInit } from '@angular/core';
+import { AfterViewInit, Component, ElementRef } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
@@ -8,10 +8,10 @@ import { CommonModule } from '@angular/common';
templateUrl: './mouse-highlighter.component.html',
styleUrls: ['./mouse-highlighter.component.scss'],
})
-export class MouseHighlighterComponent implements OnInit {
+export class MouseHighlighterComponent implements AfterViewInit {
constructor(private element: ElementRef) {}
- ngOnInit(): void {
+ ngAfterViewInit(): void {
document.body.addEventListener('mousemove', (e: MouseEvent) => {
this.element.nativeElement.style.top = `${e.y}px`;
this.element.nativeElement.style.left = `${e.x}px`;