aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_pages/playground/playground.component.ts
blob: 831132a48058a17508e538a47ad45f5efdb56f41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Component, OnInit } from '@angular/core';
import { MatSliderChange } from '@angular/material/slider';
import { CookieService } from 'ngx-cookie-service';

@Component({
  selector: 'app-playground',
  templateUrl: './playground.component.html',
  styleUrls: ['./playground.component.css']
})
export class PlaygroundComponent implements OnInit {

  animateBackground = true;
  backgroundFill = 1.0;

  constructor(private cookie: CookieService) { }

  updateFillPref(event: MatSliderChange) {
    this.backgroundFill = event.value!;
    this.cookie.set('backgroundFill', "" + this.backgroundFill);
  }

  updateAnimPref() {
    this.cookie.set('animateBackground', "" + this.animateBackground);
  }

  ngOnInit(): void {
    if (this.cookie.check('animateBackground')) {
      this.animateBackground = this.cookie.get('animateBackground') == 'true';
    }
    if (this.cookie.check('backgroundFill')) {
      this.backgroundFill = parseFloat(this.cookie.get('backgroundFill'));
    }
  }

}