Passed
Pull Request — master (#22)
by
unknown
08:10 queued 04:20
created

src/app/screens/area-sprites/area-sprites.component.ts   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 52
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 52
rs 10
c 0
b 0
f 0
wmc 4
mnd 1
bc 1
fnc 3
bpm 0.3333
cpm 1.3333
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A AreaSpritesComponent.onRem 0 3 1
A AreaSpritesComponent.onAdd 0 3 1
A AreaSpritesComponent.onFullView 0 6 2
1
import { SpriteData } from './../../data/savefile-expanded/fragments/SpriteData';
2
/**
3
   Copyright 2018 June Hanabi
4
5
   Licensed under the Apache License, Version 2.0 (the "License");
6
   you may not use this file except in compliance with the License.
7
   You may obtain a copy of the License at
8
9
       http://www.apache.org/licenses/LICENSE-2.0
10
11
   Unless required by applicable law or agreed to in writing, software
12
   distributed under the License is distributed on an "AS IS" BASIS,
13
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
   See the License for the specific language governing permissions and
15
   limitations under the License.
16
 */
17
18
import { SaveFileService } from './../../data/savefile.service';
19
import { Component } from '@angular/core';
20
21
@Component({
22
    selector: 'screen-area-sprites',
23
    templateUrl: './area-sprites.component.pug',
24
    styleUrls: ['./area-sprites.component.scss'],
25
})
26
export class AreaSpritesComponent {
27
    constructor(
28
        public fileService: SaveFileService,
29
    ) { }
30
31
    get entries() {
32
        return this.fileService.fileDataExpanded.area.sprites.spriteData;
33
    }
34
35
    onAdd() {
36
        this.fileService.fileDataExpanded.area.sprites.spriteData.push(new SpriteData(true));
37
    }
38
39
    onRem(i: number) {
40
        this.fileService.fileDataExpanded.area.sprites.spriteData.splice(i, 1);
41
    }
42
43
    onFullView(entry: any) {
44
        if (this.fullView == entry)
45
            this.fullView = null;
46
        else
47
            this.fullView = entry;
48
    }
49
50
    public fullView: any | null = null;
51
}
52